summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-02-29 12:11:37 +0100
committerAkim Demaille <akim.demaille@gmail.com>2020-02-29 12:22:31 +0100
commitc4a7e7a1ab5c48f4942e55fc5e90ff4a6c357a78 (patch)
tree813c3b28cab24281915ebf4f517e627b119db915 /examples
parent388e12ac0f79317d5d8caea84931a900d9d91f7f (diff)
downloadbison-c4a7e7a1ab5c48f4942e55fc5e90ff4a6c357a78.tar.gz
examples: bistromathic: strengthen tests
* examples/c/bistromathic/bistromathic.test: here. * examples/test: Be clearer on failing tests.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/c/bistromathic/bistromathic.test15
-rw-r--r--examples/c/bistromathic/parse.y2
-rw-r--r--examples/c/bistromathic/scan.l2
-rwxr-xr-xexamples/test9
4 files changed, 21 insertions, 7 deletions
diff --git a/examples/c/bistromathic/bistromathic.test b/examples/c/bistromathic/bistromathic.test
index 116c7575..5ecff945 100755
--- a/examples/c/bistromathic/bistromathic.test
+++ b/examples/c/bistromathic/bistromathic.test
@@ -45,9 +45,20 @@ run 0 '0.16
cat >input <<EOF
*
EOF
-run 0 "err: 1.1: syntax error: expected end of file or - or ( or end of line or double precision number or function or variable before *"
+run 0 'err: 1.1: syntax error: expected end of file or - or ( or end of line or double precision number or function or variable before *'
cat >input <<EOF
1 + 2 * * 3
EOF
-run 0 "err: 1.9: syntax error: expected - or ( or double precision number or function or variable before *"
+run 0 'err: 1.9: syntax error: expected - or ( or double precision number or function or variable before *'
+
+cat >input <<EOF
+100%
+EOF
+run 0 '100
+err: 1.4: error: invalid character'
+
+cat >input <<EOF
+1 / 0
+EOF
+run 0 'err: 1.1-5: error: division by zero'
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 9698161f..709651c2 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -123,7 +123,7 @@ exp:
{
if ($r == 0)
{
- yyerror (&@$, "division by zero");
+ yyerror (&@$, "error: division by zero");
YYERROR;
}
else
diff --git a/examples/c/bistromathic/scan.l b/examples/c/bistromathic/scan.l
index e04cbc19..a0f60be5 100644
--- a/examples/c/bistromathic/scan.l
+++ b/examples/c/bistromathic/scan.l
@@ -62,6 +62,6 @@
<<EOF>> return TOK_EOF;
-. yyerror (yylloc, "syntax error, invalid character");
+. yyerror (yylloc, "error: invalid character");
%%
/* Epilogue (C code). */
diff --git a/examples/test b/examples/test
index 8fb8ec1e..50b5d8ce 100755
--- a/examples/test
+++ b/examples/test
@@ -90,9 +90,12 @@ run ()
echo "$me: PASS: $number"
else
echo "$me: FAIL: $number"
- echo "$me: expected output: $out_exp"
- echo "$me: effective output: $out_eff"
- cat err_eff
+ echo "$me: input:"
+ sed -e 's/^/ /' input
+ echo "$me: expected output:"
+ echo "$out_exp" | sed -e 's/^/ /'
+ echo "$me: effective output:"
+ echo "$out_eff" | sed -e 's/^/ /'
exit=false
fi
else