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++) { |