[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/13] java: tests: prepare the replacement of calculator tests
From: |
Akim Demaille |
Subject: |
[PATCH 09/13] java: tests: prepare the replacement of calculator tests |
Date: |
Wed, 5 Feb 2020 18:05:01 +0100 |
Soon calculator tests for Java will move from java.at to calc.at.
Which implies improving the Java testing infrastructure in
local.at (for instance really tracking columns in positions, not just
token number). Detach java.at from local.at.
* tests/java.at (AT_JAVA_POSITION_DEFINE_OLD): New.
Use it.
---
tests/java.at | 43 ++++++++++++++++++++++++++++++++++++++++++-
tests/javapush.at | 2 +-
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/tests/java.at b/tests/java.at
index 61740c25..3c2c1c7d 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -47,6 +47,47 @@ AT_CLEANUP
# ------------------------- #
+# AT_JAVA_POSITION_DEFINE_OLD
+# -----------------------
+m4_define([AT_JAVA_POSITION_DEFINE_OLD],
+[[class Position {
+ public int line;
+ public int token;
+
+ public Position ()
+ {
+ line = 0;
+ token = 0;
+ }
+
+ public Position (int l, int t)
+ {
+ line = l;
+ token = t;
+ }
+
+ public boolean equals (Position l)
+ {
+ return l.line == line && l.token == token;
+ }
+
+ public String toString ()
+ {
+ return Integer.toString (line) + "." + Integer.toString (token);
+ }
+
+ public int lineno ()
+ {
+ return line;
+ }
+
+ public int token ()
+ {
+ return token;
+ }
+}]])
+
+
# _AT_DATA_JAVA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
# ----------------------------------------------------
# Produce 'calc.y'. Don't call this macro directly, because it contains
@@ -172,7 +213,7 @@ exp:
]AT_LEXPARAM_IF([], [[}]])[
};
%%
-]AT_JAVA_POSITION_DEFINE[
+]AT_JAVA_POSITION_DEFINE_OLD[
]])
])# _AT_DATA_JAVA_CALC_Y
diff --git a/tests/javapush.at b/tests/javapush.at
index 6d933e0b..5bbf1347 100644
--- a/tests/javapush.at
+++ b/tests/javapush.at
@@ -679,7 +679,7 @@ AT_DATA([Calc.y],
}
}
-%code { ]AT_JAVA_POSITION_DEFINE[ }
+%code { ]AT_JAVA_POSITION_DEFINE_OLD[ }
%code {
public static void main (String[] args)
--
2.25.0
- [PATCH 00/13] Clean up the Java skeleton and tests, Akim Demaille, 2020/02/05
- [PATCH 03/13] traces: don't print the stack before the gotos, Akim Demaille, 2020/02/05
- [PATCH 01/13] traces: write the "Reading a token" alone on its line, Akim Demaille, 2020/02/05
- [PATCH 02/13] traces: show the stack after reading a token, Akim Demaille, 2020/02/05
- [PATCH 05/13] java: examples: prefer switch to chains of else-if, Akim Demaille, 2020/02/05
- [PATCH 04/13] java: examples: split in two, Akim Demaille, 2020/02/05
- [PATCH 06/13] java: examples: fix the tracking of locations, Akim Demaille, 2020/02/05
- [PATCH 07/13] java: style: prefer putting the square brackets on the type, Akim Demaille, 2020/02/05
- [PATCH 08/13] java: style: avoid useless initializers, Akim Demaille, 2020/02/05
- [PATCH 09/13] java: tests: prepare the replacement of calculator tests,
Akim Demaille <=
- [PATCH 10/13] java: tests: check location tracking in the calculator, Akim Demaille, 2020/02/05
- [PATCH 12/13] java: tests: check push parsers, Akim Demaille, 2020/02/05
- [PATCH 11/13] java: tests: remove now redundant tests, Akim Demaille, 2020/02/05
- [PATCH 13/13] java: tests: remove now redundant tests, Akim Demaille, 2020/02/05