bison-patches
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]