diff options
author | 2015-10-22 12:02:28 +0000 | |
---|---|---|
committer | 2015-10-22 15:17:29 +0000 | |
commit | c708f96b4d23a1b6b03bed50013dd437ff40e92d (patch) | |
tree | 9547253098856fee4eb7ff04128f9af52439c031 /src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java | |
parent | fac21e564c9a9fe5288431f05e4ae6b5c19d35bf (diff) |
Assert the specific type of event, not just the existence of any event.
Also remove a bunch of custom uses of EventCollector, and use the (already
existing) EventCollectionApparatus instead.
--
MOS_MIGRATED_REVID=106047665
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java b/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java index 85880c767e..86e0bddd3b 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java @@ -95,7 +95,7 @@ public class BuildFileASTTest extends EvaluationTestCase { BuildFileAST buildfile = BuildFileAST.parseBuildFile(buildFile, getEventHandler(), false); assertFalse(buildfile.exec(env, getEventHandler())); - Event e = assertContainsEvent("unsupported operand type(s) for +: 'int' and 'list'"); + Event e = assertContainsError("unsupported operand type(s) for +: 'int' and 'list'"); assertEquals(4, e.getLocation().getStartLineAndColumn().getLine()); } @@ -115,7 +115,7 @@ public class BuildFileASTTest extends EvaluationTestCase { BuildFileAST buildFileAST = parseBuildFile("foo() bar() something = baz() bar()"); - Event event = assertContainsEvent("syntax error at \'bar\': expected newline"); + Event event = assertContainsError("syntax error at \'bar\': expected newline"); assertEquals("/a/build/file/BUILD", event.getLocation().getPath().toString()); assertEquals(1, event.getLocation().getStartLineAndColumn().getLine()); @@ -126,7 +126,7 @@ public class BuildFileASTTest extends EvaluationTestCase { public void testImplicitStringConcatenationFails() throws Exception { setFailFast(false); BuildFileAST buildFileAST = parseBuildFile("a = 'foo' 'bar'"); - Event event = assertContainsEvent( + Event event = assertContainsError( "Implicit string concatenation is forbidden, use the + operator"); assertEquals("/a/build/file/BUILD", event.getLocation().getPath().toString()); @@ -140,7 +140,7 @@ public class BuildFileASTTest extends EvaluationTestCase { setFailFast(false); BuildFileAST buildFileAST = parseBuildFile("a = 'foo'\n 'bar'"); - Event event = assertContainsEvent("indentation error"); + Event event = assertContainsError("indentation error"); assertEquals("/a/build/file/BUILD", event.getLocation().getPath().toString()); assertEquals(2, event.getLocation().getStartLineAndColumn().getLine()); @@ -175,7 +175,7 @@ public class BuildFileASTTest extends EvaluationTestCase { " srcs = libs,", " includes = [ abi + opt_level + '/include' ])"); assertTrue(buildFile.containsErrors()); - assertContainsEvent("syntax error at '+': expected expression"); + assertContainsError("syntax error at '+': expected expression"); assertFalse(buildFile.exec(env, getEventHandler())); assertNull(findEvent(getEventCollector(), "$error$")); // This message should not be printed anymore. |