From 30b5e2c6bed74900614d9339cd6e8786cda5bd16 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 14 Oct 2012 19:57:29 -0500 Subject: [PATCH] Fix greedy tests behaving as non-greedy in TestATNLexerInterpreter --- tool/test/org/antlr/v4/test/TestATNLexerInterpreter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tool/test/org/antlr/v4/test/TestATNLexerInterpreter.java b/tool/test/org/antlr/v4/test/TestATNLexerInterpreter.java index 56717255f..318281f50 100644 --- a/tool/test/org/antlr/v4/test/TestATNLexerInterpreter.java +++ b/tool/test/org/antlr/v4/test/TestATNLexerInterpreter.java @@ -69,22 +69,22 @@ public class TestATNLexerInterpreter extends BaseTest { LexerGrammar lg = new LexerGrammar( "lexer grammar L;\n"+ "A : 'xy'\n" + - " | 'xy' .\n" + // should not pursue '.' since xy already hit stop + " | 'xy' .\n" + // should pursue '.' since A is greedy " ;\n"); checkLexerMatches(lg, "xy", "A, EOF"); RecognitionException e = checkLexerMatches(lg, "xyz", "A, EOF"); - assertEquals("NoViableAltException('z')", e.toString()); + assertNull(e); } @Test public void testWildcardQuirk() throws Exception { LexerGrammar lg = new LexerGrammar( "lexer grammar L;\n"+ "A : 'xy'\n" + - " | 'xy' . 'z'\n" + // will not pursue '.' since xy already hit stop (prior alt) + " | 'xy' . 'z'\n" + // will pursue '.' since A is greedy " ;\n"); // checkLexerMatches(lg, "xy", "A, EOF"); RecognitionException e = checkLexerMatches(lg, "xyqz", "A, EOF"); - assertEquals("NoViableAltException('q')", e.toString()); + assertNull(e); } @Test public void testWildcardNonQuirkWhenSplitBetweenTwoRules() throws Exception {