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

Unified Diff: tools/gn/label_pattern_unittest.cc

Issue 1742303002: Accept absolute Windows paths without leading slash in GN commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format files with 'git cl format' to make presubmit script happy Created 4 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/label_pattern.cc ('k') | tools/gn/label_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/label_pattern_unittest.cc
diff --git a/tools/gn/label_pattern_unittest.cc b/tools/gn/label_pattern_unittest.cc
index 19e253027e5517cc469932a182e5d4a08357a6c5..2154af1b88a2f764239d9902fd0ac963ea7a1d11 100644
--- a/tools/gn/label_pattern_unittest.cc
+++ b/tools/gn/label_pattern_unittest.cc
@@ -28,36 +28,46 @@ TEST(LabelPattern, PatternParse) {
SourceDir current_dir("//foo/");
PatternCase cases[] = {
// Missing stuff.
- { "", false, LabelPattern::MATCH, "", "", "" },
- { ":", false, LabelPattern::MATCH, "", "", "" },
+ {"", false, LabelPattern::MATCH, "", "", ""},
+ {":", false, LabelPattern::MATCH, "", "", ""},
// Normal things.
- { ":bar", true, LabelPattern::MATCH, "//foo/", "bar", "" },
- { "//la:bar", true, LabelPattern::MATCH, "//la/", "bar", "" },
- { "*", true, LabelPattern::RECURSIVE_DIRECTORY, "", "", "" },
- { ":*", true, LabelPattern::DIRECTORY, "//foo/", "", "" },
- { "la:*", true, LabelPattern::DIRECTORY, "//foo/la/", "", "" },
- { "la/*:*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/la/", "", "" },
- { "//la:*", true, LabelPattern::DIRECTORY, "//la/", "", "" },
- { "./*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/", "", "" },
- { "foo/*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/foo/", "", "" },
- { "//l/*", true, LabelPattern::RECURSIVE_DIRECTORY, "//l/", "", "" },
+ {":bar", true, LabelPattern::MATCH, "//foo/", "bar", ""},
+ {"//la:bar", true, LabelPattern::MATCH, "//la/", "bar", ""},
+ {"*", true, LabelPattern::RECURSIVE_DIRECTORY, "", "", ""},
+ {":*", true, LabelPattern::DIRECTORY, "//foo/", "", ""},
+ {"la:*", true, LabelPattern::DIRECTORY, "//foo/la/", "", ""},
+ {"la/*:*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/la/", "", ""},
+ {"//la:*", true, LabelPattern::DIRECTORY, "//la/", "", ""},
+ {"./*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/", "", ""},
+ {"foo/*", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/foo/", "", ""},
+ {"//l/*", true, LabelPattern::RECURSIVE_DIRECTORY, "//l/", "", ""},
// Toolchains.
- { "//foo()", true, LabelPattern::MATCH, "//foo/", "foo", "" },
- { "//foo(//bar)", true, LabelPattern::MATCH, "//foo/", "foo", "//bar:bar" },
- { "//foo:*(//bar)", true, LabelPattern::DIRECTORY, "//foo/", "",
- "//bar:bar" },
- { "//foo/*(//bar)", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/", "",
- "//bar:bar" },
+ {"//foo()", true, LabelPattern::MATCH, "//foo/", "foo", ""},
+ {"//foo(//bar)", true, LabelPattern::MATCH, "//foo/", "foo", "//bar:bar"},
+ {"//foo:*(//bar)", true, LabelPattern::DIRECTORY, "//foo/", "",
+ "//bar:bar"},
+ {"//foo/*(//bar)", true, LabelPattern::RECURSIVE_DIRECTORY, "//foo/", "",
+ "//bar:bar"},
// Wildcards in invalid places.
- { "*foo*:bar", false, LabelPattern::MATCH, "", "", "" },
- { "foo*:*bar", false, LabelPattern::MATCH, "", "", "" },
- { "*foo:bar", false, LabelPattern::MATCH, "", "", "" },
- { "foo:bar*", false, LabelPattern::MATCH, "", "", "" },
- { "*:*", true, LabelPattern::RECURSIVE_DIRECTORY, "", "", "" },
+ {"*foo*:bar", false, LabelPattern::MATCH, "", "", ""},
+ {"foo*:*bar", false, LabelPattern::MATCH, "", "", ""},
+ {"*foo:bar", false, LabelPattern::MATCH, "", "", ""},
+ {"foo:bar*", false, LabelPattern::MATCH, "", "", ""},
+ {"*:*", true, LabelPattern::RECURSIVE_DIRECTORY, "", "", ""},
// Invalid toolchain stuff.
- { "//foo(//foo/bar:*)", false, LabelPattern::MATCH, "", "", "" },
- { "//foo/*(*)", false, LabelPattern::MATCH, "", "", "" },
- { "//foo(//bar", false, LabelPattern::MATCH, "", "", "" },
+ {"//foo(//foo/bar:*)", false, LabelPattern::MATCH, "", "", ""},
+ {"//foo/*(*)", false, LabelPattern::MATCH, "", "", ""},
+ {"//foo(//bar", false, LabelPattern::MATCH, "", "", ""},
+ // Absolute paths.
+ {"/la/*", true, LabelPattern::RECURSIVE_DIRECTORY, "/la/", "", ""},
+ {"/la:bar", true, LabelPattern::MATCH, "/la/", "bar", ""},
+#if defined(OS_WIN)
+ {"/C:/la/*", true, LabelPattern::RECURSIVE_DIRECTORY, "/C:/la/", "", ""},
+ {"C:/la/*", true, LabelPattern::RECURSIVE_DIRECTORY, "/C:/la/", "", ""},
+ {"/C:/la:bar", true, LabelPattern::MATCH, "/C:/la/", "bar", ""},
+ {"C:/la:bar", true, LabelPattern::MATCH, "/C:/la/", "bar", ""},
+ {"C:foo", true, LabelPattern::MATCH, "//foo/C/", "foo", ""},
+#endif
};
for (size_t i = 0; i < arraysize(cases); i++) {
« no previous file with comments | « tools/gn/label_pattern.cc ('k') | tools/gn/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698