X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/9b2d0677681e5af6073a40333d48bcf17e957f9f..6c35d22c399d53cc4ce2b0f594a3033ede3ae117:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 117af986..548032de 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,20 +20,44 @@ 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], [[%% -exp: { $$ = $1 ; } +exp: { $$ = $1 ; }; ]]) AT_CHECK([bison input.y], [1], [], -[[input.y:2: invalid $ value +[[input.y:2: invalid value: $1 ]]) AT_CLEANUP @@ -43,16 +67,40 @@ AT_CLEANUP ## Invalid @n. ## ## ------------ ## - AT_SETUP([Invalid @n]) AT_DATA([input.y], [[%% -exp: { @$ = @1 ; } +exp: { @$ = @1 ; }; +]]) + +AT_CHECK([bison input.y], [1], [], +[[input.y:2: invalid value: @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:2: invalid @ value +[[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