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

Unified Diff: tools/gn/escape_unittest.cc

Issue 247663006: Add more phony rules to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests Created 6 years, 8 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
« no previous file with comments | « tools/gn/escape.cc ('k') | tools/gn/filesystem_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/escape_unittest.cc
diff --git a/tools/gn/escape_unittest.cc b/tools/gn/escape_unittest.cc
index a637e87a3a942826654e416d9af162e479bdf0e6..44440de6e91a065c25d99178c8841c5084a7b040 100644
--- a/tools/gn/escape_unittest.cc
+++ b/tools/gn/escape_unittest.cc
@@ -5,6 +5,25 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "tools/gn/escape.h"
+TEST(Escape, Ninja) {
+ EscapeOptions opts;
+ opts.mode = ESCAPE_NINJA;
+ std::string result = EscapeString("asdf: \"$\\bar", opts, NULL);
+ EXPECT_EQ("asdf$:$ \"$$\\bar", result);
+}
+
+TEST(Escape, Shell) {
+ EscapeOptions opts;
+ opts.mode = ESCAPE_SHELL;
+ std::string result = EscapeString("asdf: \"$\\bar", opts, NULL);
+#if defined(OS_WIN)
+ // Windows shell doesn't escape backslashes.
+ EXPECT_EQ("\"asdf: \"$\\bar\"", result);
+#else
+ EXPECT_EQ("\"asdf: \\\"$\\\\bar\"", result);
+#endif
+}
+
TEST(Escape, UsedQuotes) {
EscapeOptions shell_options;
shell_options.mode = ESCAPE_SHELL;
« no previous file with comments | « tools/gn/escape.cc ('k') | tools/gn/filesystem_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698