From 3bc8e9a06f95bd7ca219b5fdbde6af58f1431369 Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Thu, 10 Sep 2015 11:00:37 +0000 Subject: Fix bug in the parser when a block was silently skipped. Some cosmetic changes with EnumSets. -- MOS_MIGRATED_REVID=102742596 --- .../java/com/google/devtools/build/lib/syntax/ParserTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/test/java/com/google/devtools') diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java index e0c074a126..b5a8015716 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java @@ -1241,6 +1241,16 @@ public class ParserTest extends EvaluationTestCase { "nested functions are not allowed. Move the function to top-level"); } + @Test + public void testElseWithoutIf() throws Exception { + setFailFast(false); + parseFileForSkylark( + "def func(a):", + // no if + " else: return a"); + assertContainsEvent("syntax error at 'else'"); + } + @Test public void testIncludeFailureSkylark() throws Exception { setFailFast(false); -- cgit v1.2.3