diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2015-02-10 14:56:01 +0100 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2015-02-10 14:56:12 +0100 |
commit | 3d75e7de1e01610a4be1b4d7e08f0df015c89b71 (patch) | |
tree | 4fcf260cebd108a4ddb159104a2182177cbe6dc2 | |
parent | 952416114729b95209dccfc4edacfc1ff13b4e82 (diff) | |
download | bison-3d75e7de1e01610a4be1b4d7e08f0df015c89b71.tar.gz |
tests: java: avoid recent Java features
Tests 463 and 464 fail with Java 1.4 compilers.
Reported by Michael Felt.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00091.html>
* tests/javapush.at: Use StringBuffer instead of StringBuilder.
-rw-r--r-- | tests/javapush.at | 24 |
1 files 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. |