mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user