From a57c1e1ed1142c93fb17368b62063410ca246659 Mon Sep 17 00:00:00 2001 From: helly Date: Sat, 8 Apr 2006 16:19:02 +0000 Subject: [PATCH] - Add testing for -o switch --- run_tests.sh.in | 10 ++++++++-- test/input12.oinput12.c.c | 37 +++++++++++++++++++++++++++++++++++++ test/input12.oinput12.c.re | 5 +++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 test/input12.oinput12.c.c create mode 100755 test/input12.oinput12.c.re diff --git a/run_tests.sh.in b/run_tests.sh.in index 19011484..bee44c2c 100644 --- a/run_tests.sh.in +++ b/run_tests.sh.in @@ -5,12 +5,18 @@ errcnt=0 tstcnt=0; for x in @top_srcdir@/test/*.re; do tstcnt=$(($tstcnt+1)) - echo $x - switches=`basename $x|sed -e 's/^.*\.\([^.]*\)\..*$/-\1/g' -e 's/^[^-].*//'g` + switches=`basename $x|sed -e 's/^[^.]*\.\(.*\)\.re$/-\1/g' -e 's/^[^-].*//g'` + genname=`echo $switches|sed -e 's,^.[^o].*$,,g' -e 's,^-o\([ -]*\),@builddir@/test/\1,g'` + switches=`echo $switches|sed -e 's,^-o\(.*\)$,-o@builddir@/test/\1,g'` # don't use the -o flag, since it makes it harder to diff. + echo $x: $switches outname=@builddir@/test/`basename ${x%.re}.temp` difname=@builddir@/test/`basename ${x%.re}.diff` @builddir@/re2c $switches $x 2>&1 | sed -e "s,$x,`basename $x`,g" -e "s,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g" > $outname + if test -n "$genname"; then + cat $genname | sed -e 's,@builddir@/test/,,g' -e "s,/\* Generated by re2c .*\*/,/\* Generated by re2c \*/,g" > $outname + rm $genname + fi # if diff -u -I '#line [0-9]*' ${x%.re}.c $outname > $difname; then if diff -u ${x%.re}.c $outname > $difname; then echo "Passed." diff --git a/test/input12.oinput12.c.c b/test/input12.oinput12.c.c new file mode 100755 index 00000000..cf5cbc2b --- /dev/null +++ b/test/input12.oinput12.c.c @@ -0,0 +1,37 @@ +/* Generated by re2c */ +#line 1 "input12.oinput12.c.re" + +#line 5 "input12.c" +{ + YYCTYPE yych; + + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch(yych){ + case 'a': goto yy3; + default: goto yy2; + } +yy2: +yy3: + ++YYCURSOR; + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + switch(yych){ + case 'a': goto yy3; + case 'b': goto yy5; + default: goto yy2; + } +yy5: + yych = *++YYCURSOR; + switch(yych){ + case 'b': goto yy6; + default: goto yy2; + } +yy6: + ++YYCURSOR; +#line 3 "input12.oinput12.c.re" + { return 1; } +#line 35 "input12.c" +} +#line 5 "input12.oinput12.c.re" + diff --git a/test/input12.oinput12.c.re b/test/input12.oinput12.c.re new file mode 100755 index 00000000..6df25196 --- /dev/null +++ b/test/input12.oinput12.c.re @@ -0,0 +1,5 @@ +/*!re2c + +[a]+ "bb" { return 1; } + +*/ -- 2.40.0