Index: tools/gn/file_template_unittest.cc |
diff --git a/tools/gn/file_template_unittest.cc b/tools/gn/file_template_unittest.cc |
index cd5611c1dfdeec1c62a772a85baf06d1a68c6f41..8e3bf40b90c4b22850f532726b1e83c3407af3be 100644 |
--- a/tools/gn/file_template_unittest.cc |
+++ b/tools/gn/file_template_unittest.cc |
@@ -63,11 +63,19 @@ TEST(FileTemplate, NinjaExpansions) { |
std::ostringstream out; |
t.WriteWithNinjaExpansions(out); |
+#if defined(OS_WIN) |
// The third argument should get quoted since it contains a space, and the |
// embedded quotes should get shell escaped. |
EXPECT_EQ( |
" -i ${source} \"--out=foo$ bar\\\"${source_name_part}\\\".o\" \"\"", |
out.str()); |
+#else |
+ // On Posix we don't need to quote the whole thing and can escape all |
+ // individual bad chars. |
+ EXPECT_EQ( |
+ " -i ${source} --out=foo\\$ bar\\\"${source_name_part}\\\".o \"\"", |
+ out.str()); |
+#endif |
} |
TEST(FileTemplate, NinjaVariables) { |
@@ -80,7 +88,7 @@ TEST(FileTemplate, NinjaVariables) { |
std::ostringstream out; |
EscapeOptions options; |
- options.mode = ESCAPE_NINJA_SHELL; |
+ options.mode = ESCAPE_NINJA_COMMAND; |
t.WriteNinjaVariablesForSubstitution(out, "../../foo/bar.txt", options); |
// Just the variables used above should be written. |