X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/bfcf1f3af044b8aa2193a4271a065085f7868777..dafdc66ff0a0344c390d0f5612e9b469d6855e00:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 2ee59f29..8c952aa9 100644 --- a/tests/input.at +++ b/tests/input.at @@ -1,5 +1,5 @@ # Checking the output filenames. -*- Autotest -*- -# Copyright 2002 Free Software Foundation, Inc. +# Copyright (C) 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,11 +20,35 @@ AT_BANNER([[Input Processing.]]) # Mostly test that we are robust to mistakes. + +## ----------------------- ## +## Torturing the Scanner. ## +## ----------------------- ## + +AT_SETUP([Torturing the Scanner]) + +AT_DATA([input.y], +[[%{ +/* This is seen in GCC: a %{ and %} in middle of a comment. */ +const char *foo = "So %{ and %} can be here."; +%} +/* %{ and %} can be here too. */ + +%% +exp: 'a'; +]]) + +AT_CHECK([bison input.y]) + +AT_CLEANUP + + + + ## ------------ ## ## Invalid $n. ## ## ------------ ## - AT_SETUP([Invalid $n]) AT_DATA([input.y], @@ -33,7 +57,7 @@ exp: { $$ = $1 ; }; ]]) AT_CHECK([bison input.y], [1], [], -[[input.y:2: invalid value: $1 +[[input.y:2.6-14: invalid value: $1 ]]) AT_CLEANUP @@ -43,7 +67,6 @@ AT_CLEANUP ## Invalid @n. ## ## ------------ ## - AT_SETUP([Invalid @n]) AT_DATA([input.y], @@ -56,3 +79,28 @@ AT_CHECK([bison input.y], [1], [], ]]) AT_CLEANUP + + +## -------------- ## +## Type clashes. ## +## -------------- ## + +AT_SETUP([Type clashes]) + +AT_DATA([input.y], +[[%token foo +%type exp +%% +exp: foo {} foo + | foo + | /* Empty. */ + ; +]]) + +AT_CHECK([bison input.y], [1], [], +[[input.y:5: type clash (`bar' `') on default action +input.y:6: type clash (`bar' `') on default action +input.y:7: empty rule for typed nonterminal, and no action +]]) + +AT_CLEANUP