]> granicus.if.org Git - re2c/commitdiff
- Add testing for -o switch
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 8 Apr 2006 16:19:02 +0000 (16:19 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Sat, 8 Apr 2006 16:19:02 +0000 (16:19 +0000)
run_tests.sh.in
test/input12.oinput12.c.c [new file with mode: 0755]
test/input12.oinput12.c.re [new file with mode: 0755]

index 1901148468da09611bced1bbf14856b65e6fdd44..bee44c2cce6acf1290121cd6932b738163cf78c4 100644 (file)
@@ -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 (executable)
index 0000000..cf5cbc2
--- /dev/null
@@ -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 (executable)
index 0000000..6df2519
--- /dev/null
@@ -0,0 +1,5 @@
+/*!re2c
+
+[a]+ "bb"  { return 1; }
+
+*/