Index: tools/gn/parser_unittest.cc |
diff --git a/tools/gn/parser_unittest.cc b/tools/gn/parser_unittest.cc |
index 4ebefb20f89d323ada9b0fcb0804eec853606fd6..823a9830588948c535e831cc2a47c2efc5c28812 100644 |
--- a/tools/gn/parser_unittest.cc |
+++ b/tools/gn/parser_unittest.cc |
@@ -677,3 +677,31 @@ TEST(Parser, HangingIf) { |
TEST(Parser, NegatingList) { |
DoParserErrorTest("executable(\"wee\") { sources =- [ \"foo.cc\" ] }", 1, 30); |
} |
+ |
+TEST(Parser, ConditionNoBracesIf) { |
+ DoParserErrorTest( |
+ "if (true)\n" |
+ " foreach(foo, []) {}\n" |
+ "else {\n" |
+ " foreach(bar, []) {}\n" |
+ "}\n", |
+ 2, 3); |
+} |
+ |
+TEST(Parser, ConditionNoBracesElse) { |
+ DoParserErrorTest( |
+ "if (true) {\n" |
+ " foreach(foo, []) {}\n" |
+ "} else\n" |
+ " foreach(bar, []) {}\n", |
+ 4, 3); |
+} |
+ |
+TEST(Parser, ConditionNoBracesElseIf) { |
+ DoParserErrorTest( |
+ "if (true) {\n" |
+ " foreach(foo, []) {}\n" |
+ "} else if (true)\n" |
+ " foreach(bar, []) {}\n", |
+ 4, 3); |
+} |