]> git.saurik.com Git - bison.git/blobdiff - tests/input.at
tests: check the "%define variant" is deprecated.
[bison.git] / tests / input.at
index 5e5b1e8f2995079d024b719193477b781a2d4914..f60eaec7237daa4fcfa2010073c9595ffe54a829 100644 (file)
@@ -1270,7 +1270,7 @@ AT_CLEANUP
 ## %define Boolean variables.  ##
 ## --------------------------- ##
 
-AT_SETUP([[%define Boolean variables]])
+AT_SETUP([["%define" Boolean variables]])
 
 AT_DATA([Input.y],
 [[%language "Java"
@@ -1290,7 +1290,11 @@ AT_CLEANUP
 ## %define enum variables.  ##
 ## ------------------------ ##
 
-AT_SETUP([[%define enum variables]])
+AT_SETUP([["%define" enum variables]])
+
+# Check errors from the front-end, and the back-end.  Since the
+# front-end quits before calling the back-end, these tests cannot be
+# fused.
 
 # Front-end.
 AT_DATA([[input.y]],
@@ -1298,22 +1302,25 @@ AT_DATA([[input.y]],
 %%
 start: ;
 ]])
-AT_BISON_CHECK([[input.y]], [[1]], [[]],
+AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
 [[input.y:1.9-28: error: invalid value for %define variable 'lr.default-reduction': 'bogus'
+ %define lr.default-reduction bogus
+         ^^^^^^^^^^^^^^^^^^^^
 input.y:1.9-28:     accepted value: 'most'
 input.y:1.9-28:     accepted value: 'consistent'
 input.y:1.9-28:     accepted value: 'accepting'
 ]])
 
 # Back-end.
-# FIXME: these should be indented, but we shouldn't mess with the m4 yet
 AT_DATA([[input.y]],
 [[%define api.push-pull neither
 %%
 start: ;
 ]])
-AT_BISON_CHECK([[input.y]], [1], [],
+AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
 [[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
+ %define api.push-pull neither
+         ^^^^^^^^^^^^^
 input.y:1.9-21:     accepted value: 'pull'
 input.y:1.9-21:     accepted value: 'push'
 input.y:1.9-21:     accepted value: 'both'
@@ -1325,53 +1332,37 @@ AT_CLEANUP
 ## %define backward compatibility.  ##
 ## -------------------------------- ##
 
-AT_SETUP([[%define backward compatibility]])
-
-# The error messages tell us whether underscores in these variables are
-# being converted to dashes.
+AT_SETUP([["%define" backward compatibility]])
 
+# The error messages tell us whether the variables are properly updated.
 AT_DATA([[input.y]],
-[[%define api.push_pull "neither"
-%%
-start: ;
-]])
-AT_BISON_CHECK([[input.y]], [1], [],
-[[input.y:1.9-21: warning: deprecated %define variable name: 'api.push_pull', use 'api.push-pull' [-Wdeprecated]
-input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
-input.y:1.9-21:     accepted value: 'pull'
-input.y:1.9-21:     accepted value: 'push'
-input.y:1.9-21:     accepted value: 'both'
-]])
-
-AT_DATA([[input.y]],
-[[%define lr.keep_unreachable_states maybe
-%%
-start: ;
-]])
-AT_BISON_CHECK([[input.y]], [1], [],
-[[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-state' [-Wdeprecated]
-input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-state'
-]])
-
-AT_DATA([[input.y]],
-[[%define namespace "foo"
+[[%define api.push_pull both
+%define lr.keep_unreachable_states maybe
+%define namespace "foo"
 %define api.namespace "foo"
+%define variant
 %%
 start: ;
 ]])
-AT_BISON_CHECK([[input.y]], [1], [],
-[[input.y:1.9-17: warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]
-input.y:2.9-21: error: %define variable 'api.namespace' redefined
-input.y:1.9-17:     previous definition
-]])
-
-AT_DATA([[input.y]],
-[[%define foo_bar "baz"
-%%
-start: ;
-]])
-AT_BISON_CHECK([[input.y]], [[1]], [],
-[[input.y:1.9-15: error: %define variable 'foo_bar' is not used
+AT_BISON_CHECK([[-fcaret input.y]], [1], [],
+[[input.y:1.9-21: warning: deprecated directive, use '%define api.push-pull both' [-Wdeprecated]
+ %define api.push_pull both
+         ^^^^^^^^^^^^^
+input.y:2.9-34: warning: deprecated directive, use '%define lr.keep-unreachable-state maybe' [-Wdeprecated]
+ %define lr.keep_unreachable_states maybe
+         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+input.y:3.9-17: warning: deprecated directive, use '%define api.namespace foo' [-Wdeprecated]
+ %define namespace "foo"
+         ^^^^^^^^^
+input.y:4.9-21: error: %define variable 'api.namespace' redefined
+ %define api.namespace "foo"
+         ^^^^^^^^^^^^^
+input.y:3.9-17:     previous definition
+ %define namespace "foo"
+         ^^^^^^^^^
+input.y:5.9-15: warning: deprecated directive, use '%define api.value.type variant' [-Wdeprecated]
+ %define variant
+         ^^^^^^^
 ]])
 
 AT_CLEANUP
@@ -1627,7 +1618,7 @@ AT_CLEANUP
 ## %name-prefix and %define api.prefix are incompatible.  ##
 ## ------------------------------------------------------ ##
 
-AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
+AT_SETUP([[%name-prefix and api.prefix are incompatible]])
 
 # AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
 # --------------------------------------------