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

Side by Side Diff: tools/gn/escape_unittest.cc

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/escape.cc ('k') | tools/gn/example/.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/escape.h" 6 #include "tools/gn/escape.h"
7 7
8 TEST(Escape, Ninja) { 8 TEST(Escape, Ninja) {
9 EscapeOptions opts; 9 EscapeOptions opts;
10 opts.mode = ESCAPE_NINJA; 10 opts.mode = ESCAPE_NINJA;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 EscapeOptions opts; 43 EscapeOptions opts;
44 opts.mode = ESCAPE_NINJA_COMMAND; 44 opts.mode = ESCAPE_NINJA_COMMAND;
45 opts.platform = ESCAPE_PLATFORM_POSIX; 45 opts.platform = ESCAPE_PLATFORM_POSIX;
46 46
47 // : and $ ninja escaped with $. Then Shell-escape backslashes and quotes. 47 // : and $ ninja escaped with $. Then Shell-escape backslashes and quotes.
48 EXPECT_EQ("a$:\\$ \\\"\\$$\\\\b", EscapeString("a: \"$\\b", opts, NULL)); 48 EXPECT_EQ("a$:\\$ \\\"\\$$\\\\b", EscapeString("a: \"$\\b", opts, NULL));
49 49
50 // Some more generic shell chars. 50 // Some more generic shell chars.
51 EXPECT_EQ("a_\\;\\<\\*b", EscapeString("a_;<*b", opts, NULL)); 51 EXPECT_EQ("a_\\;\\<\\*b", EscapeString("a_;<*b", opts, NULL));
52 } 52 }
53
54 TEST(Escape, NinjaPreformatted) {
55 EscapeOptions opts;
56 opts.mode = ESCAPE_NINJA_PREFORMATTED_COMMAND;
57
58 // Only $ is escaped.
59 EXPECT_EQ("a: \"$$\\b<;", EscapeString("a: \"$\\b<;", opts, NULL));
60 }
OLDNEW
« no previous file with comments | « tools/gn/escape.cc ('k') | tools/gn/example/.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698