Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: tools/gn/file_template_unittest.cc

Issue 311733002: Redo escaping in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698