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

Unified Diff: tools/gn/analyzer_unittest.cc

Issue 2341683006: Fix various issues with `gn analyze`. (Closed)
Patch Set: update docs Created 4 years, 3 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/analyzer.cc ('k') | tools/gn/command_analyze.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/analyzer_unittest.cc
diff --git a/tools/gn/analyzer_unittest.cc b/tools/gn/analyzer_unittest.cc
index 6910a678483c2059d6a03c96b3e61e12d4609ef2..dba0e7701dd8a7d8af7feb3e2a3ad02acd8909d7 100644
--- a/tools/gn/analyzer_unittest.cc
+++ b/tools/gn/analyzer_unittest.cc
@@ -120,7 +120,7 @@ TEST_F(AnalyzerTest, AllWasPruned) {
RunBasicTest(
"{"
" \"files\": [ \"//d/b.cc\" ],"
- " \"compile_targets\": [ \"all\" ],"
+ " \"additional_compile_targets\": [ \"all\" ],"
" \"test_targets\": [ ]"
"}",
"{"
@@ -134,7 +134,7 @@ TEST_F(AnalyzerTest, NoDependency) {
RunBasicTest(
"{"
" \"files\":[ \"//missing.cc\" ],"
- " \"compile_targets\": [ \"all\" ],"
+ " \"additional_compile_targets\": [ \"all\" ],"
" \"test_targets\": [ \"//:a\" ]"
"}",
"{"
@@ -148,7 +148,7 @@ TEST_F(AnalyzerTest, NoFilesNoTargets) {
RunBasicTest(
"{"
" \"files\": [],"
- " \"compile_targets\": [],"
+ " \"additional_compile_targets\": [],"
" \"test_targets\": []"
"}",
"{"
@@ -162,7 +162,7 @@ TEST_F(AnalyzerTest, OneTestTargetModified) {
RunBasicTest(
"{"
" \"files\": [ \"//a.cc\" ],"
- " \"compile_targets\": [],"
+ " \"additional_compile_targets\": [],"
" \"test_targets\": [ \"//:a\" ]"
"}",
"{"
@@ -171,3 +171,32 @@ TEST_F(AnalyzerTest, OneTestTargetModified) {
"\"test_targets\":[\"//:a\"]"
"}");
}
+
+TEST_F(AnalyzerTest, FilesArentSourceAbsolute) {
+ RunBasicTest(
+ "{"
+ " \"files\": [ \"a.cc\" ],"
+ " \"additional_compile_targets\": [],"
+ " \"test_targets\": [ \"//:a\" ]"
+ "}",
+ "{"
+ "\"error\":"
+ "\"\\\"a.cc\\\" is not a source-absolute or absolute path.\","
+ "\"invalid_targets\":[]"
+ "}");
+}
+
+TEST_F(AnalyzerTest, WrongInputFields) {
+ RunBasicTest(
+ "{"
+ " \"files\": [ \"//a.cc\" ],"
+ " \"compile_targets\": [],"
+ " \"test_targets\": [ \"//:a\" ]"
+ "}",
+ "{"
+ "\"error\":"
+ "\"Input does not have a key named "
+ "\\\"additional_compile_targets\\\" with a list value.\","
+ "\"invalid_targets\":[]"
+ "}");
+}
« no previous file with comments | « tools/gn/analyzer.cc ('k') | tools/gn/command_analyze.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698