bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tests: refactor checks on sets


From: Akim Demaille
Subject: tests: refactor checks on sets
Date: Wed, 29 May 2019 08:40:28 +0200

commit 7f017ae1c926ba58e415140af75587f096dc4960
Author: Akim Demaille <address@hidden>
Date:   Thu May 2 15:40:14 2019 +0200

    tests: refactor checks on sets
    
    It will be convenient to check sets elsewhere.
    
    * tests/sets.at (AT_EXTRACT_SETS): Transform into...
    * tests/local.at (AT_SETS_CHECK): this.
    * tests/sets.at: Adjust.

diff --git a/tests/local.at b/tests/local.at
index 8cce20b7..976d9caa 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -1353,6 +1353,29 @@ m4_popdef([AT_COND_CASE])])
 
 
 
+# AT_SETS_CHECK(INPUT, SETS, EXPECTED)
+# ------------------------------------
+# Extract the information about the grammar sets from a bison
+# trace output (INPUT), and compare to EXPECTED.
+#
+# And remember, there is no alternation in portable sed.
+m4_define([AT_SETS_CHECK],
+[AT_DATA([extract.sed],
+[[#n
+]m4_foreach([m4_Set], [$2], [[
+/^]m4_Set[/ {
+   :]m4_Set[
+   p
+   n
+   /^ *$/ !b ]m4_Set[
+}
+]])])
+
+AT_CHECK([sed -f extract.sed $1], 0, [$3])
+])
+
+
+
 
 ## ----------------------- ##
 ## Launch the test suite.  ##
diff --git a/tests/sets.at b/tests/sets.at
index 2c173673..5dbc50dc 100644
--- a/tests/sets.at
+++ b/tests/sets.at
@@ -17,45 +17,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-# AT_EXTRACT_SETS(INPUT, OUTPUT)
-# ------------------------------
-# Extract the information about the grammar sets from a bison
-# trace output (INPUT), and save it in OUTPUT.
-# And remember, there is no alternation in portable sed.
-m4_define([AT_EXTRACT_SETS],
-[AT_DATA([extract.sed],
-[[#n
-/^NULLABLE$/ {
-   :null
-   p
-   n
-   /^ *$/ !b null
-}
-/^FIRSTS$/ {
-   :firsts
-   p
-   n
-   /^ *$/ !b firsts
-}
-/^FDERIVES$/ {
-   :fderiv
-   p
-   n
-   /^ *$/ !b fderiv
-}
-/^DERIVES$/ {
-   :deriv
-   p
-   n
-   /^ *$/ !b deriv
-}
-]])
-AT_CHECK([sed -f extract.sed $1], 0, [stdout])
-AT_CHECK([mv stdout $2])
-])
-
-
-
 AT_BANNER([[Grammar Sets (Firsts etc.).]])
 
 
@@ -79,8 +40,7 @@ e: 'e' | /* Nothing */;
 ]])
 
 AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr])
-AT_EXTRACT_SETS([stderr], [sets])
-AT_CHECK([[cat sets]], [],
+AT_SETS_CHECK([stderr], [[DERIVES], [NULLABLE], [FIRSTS], [FDERIVES]],
 [[DERIVES
   $accept derives
       0  e $end
@@ -209,8 +169,7 @@ exp:
 ]])
 
 AT_BISON_CHECK([[--trace=sets input.y]], [], [], [stderr])
-AT_EXTRACT_SETS([stderr], [sets])
-AT_CHECK([[cat sets]], [],
+AT_SETS_CHECK([stderr], [[DERIVES], [NULLABLE], [FIRSTS], [FDERIVES]],
 [[DERIVES
   $accept derives
       0  exp $end




reply via email to

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