From 3d75e7de1e01610a4be1b4d7e08f0df015c89b71 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 10 Feb 2015 14:56:01 +0100 Subject: tests: java: avoid recent Java features Tests 463 and 464 fail with Java 1.4 compilers. Reported by Michael Felt. * tests/javapush.at: Use StringBuffer instead of StringBuilder. --- tests/javapush.at | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/javapush.at b/tests/javapush.at index 28e69471..dcac4f96 100644 --- a/tests/javapush.at +++ b/tests/javapush.at @@ -241,10 +241,13 @@ m4_define([AT_CALC_BODY],[ static StringReader getinput(String filename) throws IOException { - StringBuilder buf = new StringBuilder(); + // Yes, there are better alternatives to StringBuffer. But we + // don't really care about performances here, while portability + // to older Java matters. + StringBuffer buf = new StringBuffer(); FileReader file = new FileReader(filename); int c; - while ((c=file.read()) > 0) + while (0 < (c = file.read())) buf.append((char)c); file.close(); return new StringReader(buf.toString()); @@ -302,6 +305,13 @@ exp: ; ]) + + +## ------------------------------------- ## +## Calc parser with api.push-pull both. ## +## ------------------------------------- ## + + # Test that the states transitioned by the push parser are the # same as for the pull parser. This test is assumed to work # if it produces the same partial trace of stack states as is @@ -577,8 +587,9 @@ Stack now 0 7 15 ]]) AT_BISON_CHECK([PUSHPULLFLAG [-o Calc.java Calc.y]]) + AT_JAVA_COMPILE([[Calc.java]]) -#Verify that this is a push parser. +# Verify that this is a push parser. AT_CHECK_JAVA_GREP([[Calc.java]], [[.*public void push_parse_initialize().*]]) # Capture stderr output for comparison purposes. @@ -593,6 +604,13 @@ AT_CHECK([[sed -e '/^Stack now.*$/p' -e d ./stderr]], AT_BISON_OPTION_POPDEFS AT_CLEANUP + + +## ---------------------------------------------------------------- ## +## Calc parser with %locations %code lexer and api.push-pull both. ## +## ---------------------------------------------------------------- ## + + # This test looks for location reporting by looking # at the lexer output with locations enabled. # It defines a lexer that reports location info. -- cgit v1.2.1