]> git.saurik.com Git - bison.git/blobdiff - tests/regression.at
* tests/regression.at (AT_TEST_CPP_GUARD_H): Adjust the clean up
[bison.git] / tests / regression.at
index 8981874542b14b9f01e6083b22038d0a683d7f2e..fea4a6624401493d40d57ecfd96c2650bd013d2e 100644 (file)
@@ -44,6 +44,29 @@ AT_CLEANUP([duplicate.*])
 
 
 
+## ---------------------- ##
+## Mixing %token styles.  ##
+## ---------------------- ##
+
+
+AT_SETUP([Mixing %token styles])
+
+# Taken from the documentation.
+AT_DATA([input.y],
+[[%token  <operator>  OR      "||"
+%token  <operator>  LE 134  "<="
+%left  OR  "<="
+%%
+exp: ;
+%%
+]])
+
+AT_CHECK([bison -v input.y -o input.c], 0, ignore, ignore)
+
+AT_CLEANUP([input.*])
+
+
+
 ## ---------------------- ##
 ## %union and --defines.  ##
 ## ---------------------- ##
@@ -148,23 +171,34 @@ AT_CHECK([bison input.y], [1], [],
 AT_CLEANUP
 
 
+
 ## --------------------- ##
 ## Invalid CPP headers.  ##
 ## --------------------- ##
 
-AT_SETUP([Invalid CPP headers])
+# AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE)
+# -------------------------------------
+m4_define([AT_TEST_CPP_GUARD_H],
+[AT_SETUP([Invalid CPP guards: $1])
 
-mkdir input
+# possibly create and nuke inner directories.
+m4_bmatch([$1], [[/]],
+[dirname=`AS_DIRNAME([$1])`
+AS_MKDIR_P([$dirname])
+AT_CLEANUP_FILES([$dirname])])
 
-AT_DATA([input/input.y],
+AT_DATA([$1.y],
 [%%
 dummy:
 ])
 
-AT_CHECK([bison --defines input/input.y])
+AT_CHECK([bison --defines=$1.h $1.y])
 
-AT_CHECK([sed 1q input/input.tab.h], 0,
-[[#ifndef INPUT_INPUT_TAB_H
-]])
+# CPP should be happy with it.
+AT_CHECK([$CC -E $1.h], 0, [ignore])
+
+AT_CLEANUP($1.*)
+])
 
-AT_CLEANUP(input)
+AT_TEST_CPP_GUARD_H([input/input])
+AT_TEST_CPP_GUARD_H([9foo])