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

Unified Diff: tools/gn/label_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_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/label_unittest.cc
diff --git a/tools/gn/label_unittest.cc b/tools/gn/label_unittest.cc
index 37c097f23224e52e92598ab9eae44907a84ab5d2..986aa9b50d61795bd878990c42e03cf8d9e7c935 100644
--- a/tools/gn/label_unittest.cc
+++ b/tools/gn/label_unittest.cc
@@ -27,46 +27,48 @@ struct ParseDepStringCase {
TEST(Label, Resolve) {
ParseDepStringCase cases[] = {
- // cur input succ expected dir name tc dir tc name
- { "//chrome/", "", false, "", "", "", "" },
- { "//chrome/", "/", false, "", "", "", "" },
- { "//chrome/", ":", false, "", "", "", "" },
- { "//chrome/", "/:", false, "", "", "", "" },
- { "//chrome/", "blah", true, "//chrome/blah/", "blah", "//t/", "d" },
- { "//chrome/", "blah:bar", true, "//chrome/blah/", "bar", "//t/", "d" },
- // Absolute paths.
- { "//chrome/", "/chrome:bar", true , "/chrome/", "bar", "//t/", "d" },
- { "//chrome/", "/chrome/:bar", true, "/chrome/", "bar", "//t/", "d" },
+ {"//chrome/", "", false, "", "", "", ""},
+ {"//chrome/", "/", false, "", "", "", ""},
+ {"//chrome/", ":", false, "", "", "", ""},
+ {"//chrome/", "/:", false, "", "", "", ""},
+ {"//chrome/", "blah", true, "//chrome/blah/", "blah", "//t/", "d"},
+ {"//chrome/", "blah:bar", true, "//chrome/blah/", "bar", "//t/", "d"},
+ // Absolute paths.
+ {"//chrome/", "/chrome:bar", true, "/chrome/", "bar", "//t/", "d"},
+ {"//chrome/", "/chrome/:bar", true, "/chrome/", "bar", "//t/", "d"},
#if defined(OS_WIN)
- { "//chrome/", "/C:/chrome:bar", true , "/C:/chrome/", "bar", "//t/", "d" },
- { "//chrome/", "/C:/chrome/:bar", true, "/C:/chrome/", "bar", "//t/", "d" },
- { "//chrome/", "C:/chrome:bar", false, "", "", "", "" },
+ {"//chrome/", "/C:/chrome:bar", true, "/C:/chrome/", "bar", "//t/", "d"},
+ {"//chrome/", "/C:/chrome/:bar", true, "/C:/chrome/", "bar", "//t/", "d"},
+ {"//chrome/", "C:/chrome:bar", true, "/C:/chrome/", "bar", "//t/", "d"},
#endif
- // Refers to root dir.
- { "//chrome/", "//:bar", true, "//", "bar", "//t/", "d" },
- // Implicit directory
- { "//chrome/", ":bar", true, "//chrome/", "bar", "//t/", "d" },
- { "//chrome/renderer/", ":bar", true, "//chrome/renderer/", "bar", "//t/", "d" },
- // Implicit names.
- { "//chrome/", "//base", true, "//base/", "base", "//t/", "d" },
- { "//chrome/", "//base/i18n", true, "//base/i18n/", "i18n", "//t/", "d" },
- { "//chrome/", "//base/i18n:foo", true, "//base/i18n/", "foo", "//t/", "d" },
- { "//chrome/", "//", false, "", "", "", "" },
- // Toolchain parsing.
- { "//chrome/", "//chrome:bar(//t:n)", true, "//chrome/", "bar", "//t/", "n" },
- { "//chrome/", "//chrome:bar(//t)", true, "//chrome/", "bar", "//t/", "t" },
- { "//chrome/", "//chrome:bar(//t:)", true, "//chrome/", "bar", "//t/", "t" },
- { "//chrome/", "//chrome:bar()", true, "//chrome/", "bar", "//t/", "d" },
- { "//chrome/", "//chrome:bar(foo)", true, "//chrome/", "bar", "//chrome/foo/", "foo" },
- { "//chrome/", "//chrome:bar(:foo)", true, "//chrome/", "bar", "//chrome/", "foo" },
- // TODO(brettw) it might be nice to make this an error:
- //{ "//chrome/", "//chrome:bar())", false, "", "", "", "" },
- { "//chrome/", "//chrome:bar(//t:bar(tc))", false, "", "", "", "" },
- { "//chrome/", "//chrome:bar(()", false, "", "", "", "" },
- { "//chrome/", "(t:b)", false, "", "", "", "" },
- { "//chrome/", ":bar(//t/b)", true, "//chrome/", "bar", "//t/b/", "b" },
- { "//chrome/", ":bar(/t/b)", true, "//chrome/", "bar", "/t/b/", "b" },
- { "//chrome/", ":bar(t/b)", true, "//chrome/", "bar", "//chrome/t/b/", "b" },
+ // Refers to root dir.
+ {"//chrome/", "//:bar", true, "//", "bar", "//t/", "d"},
+ // Implicit directory
+ {"//chrome/", ":bar", true, "//chrome/", "bar", "//t/", "d"},
+ {"//chrome/renderer/", ":bar", true, "//chrome/renderer/", "bar", "//t/",
+ "d"},
+ // Implicit names.
+ {"//chrome/", "//base", true, "//base/", "base", "//t/", "d"},
+ {"//chrome/", "//base/i18n", true, "//base/i18n/", "i18n", "//t/", "d"},
+ {"//chrome/", "//base/i18n:foo", true, "//base/i18n/", "foo", "//t/", "d"},
+ {"//chrome/", "//", false, "", "", "", ""},
+ // Toolchain parsing.
+ {"//chrome/", "//chrome:bar(//t:n)", true, "//chrome/", "bar", "//t/", "n"},
+ {"//chrome/", "//chrome:bar(//t)", true, "//chrome/", "bar", "//t/", "t"},
+ {"//chrome/", "//chrome:bar(//t:)", true, "//chrome/", "bar", "//t/", "t"},
+ {"//chrome/", "//chrome:bar()", true, "//chrome/", "bar", "//t/", "d"},
+ {"//chrome/", "//chrome:bar(foo)", true, "//chrome/", "bar",
+ "//chrome/foo/", "foo"},
+ {"//chrome/", "//chrome:bar(:foo)", true, "//chrome/", "bar", "//chrome/",
+ "foo"},
+ // TODO(brettw) it might be nice to make this an error:
+ //{"//chrome/", "//chrome:bar())", false, "", "", "", "" },
+ {"//chrome/", "//chrome:bar(//t:bar(tc))", false, "", "", "", ""},
+ {"//chrome/", "//chrome:bar(()", false, "", "", "", ""},
+ {"//chrome/", "(t:b)", false, "", "", "", ""},
+ {"//chrome/", ":bar(//t/b)", true, "//chrome/", "bar", "//t/b/", "b"},
+ {"//chrome/", ":bar(/t/b)", true, "//chrome/", "bar", "/t/b/", "b"},
+ {"//chrome/", ":bar(t/b)", true, "//chrome/", "bar", "//chrome/t/b/", "b"},
};
Label default_toolchain(SourceDir("//t/"), "d");
@@ -82,12 +84,9 @@ TEST(Label, Resolve) {
Label::Resolve(SourceDir(cur.cur_dir), default_toolchain, v, &err);
EXPECT_EQ(cur.success, !err.has_error()) << i << " " << cur.str;
if (!err.has_error() && cur.success) {
- EXPECT_EQ(cur.expected_dir, result.dir().value())
- << i << " " << cur.str;
- EXPECT_EQ(cur.expected_name, result.name())
- << i << " " << cur.str;
- EXPECT_EQ(cur.expected_toolchain_dir,
- result.toolchain_dir().value())
+ EXPECT_EQ(cur.expected_dir, result.dir().value()) << i << " " << cur.str;
+ EXPECT_EQ(cur.expected_name, result.name()) << i << " " << cur.str;
+ EXPECT_EQ(cur.expected_toolchain_dir, result.toolchain_dir().value())
<< i << " " << cur.str;
EXPECT_EQ(cur.expected_toolchain_name, result.toolchain_name())
<< i << " " << cur.str;
« no previous file with comments | « tools/gn/label_pattern_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698