diff options
Diffstat (limited to 'tests/test-yydecl-gen.sh')
-rwxr-xr-x | tests/test-yydecl-gen.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-yydecl-gen.sh b/tests/test-yydecl-gen.sh new file mode 100755 index 0000000..0a70915 --- /dev/null +++ b/tests/test-yydecl-gen.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Generate test for the %yydecl option of flex on a specified back end +backend="$1" + +cat <<EOF_OUTER +#! /bin/sh +# Test %yydecl option of flex on ${backend} backend. +trap 'rm /tmp/td\$\$' EXIT HUP INT QUIT TERM + +teeout=/dev/null +if [ "\$1" = "-d" ] +then + shift + teeout=/dev/stderr +fi + +cat >/tmp/td\$\$ <<EOF +%option yydecl="int foobar(void)" emit="${backend}" +%% +%% +EOF +if ../src/flex -t /tmp/td\$\$ | tee \${teeout} | grep "int foobar(void)" >/dev/null +then + echo "%yydecl test on ${backend} SUCCEEDED" + exit 0 +else + echo "%yydecl test on ${backend} FAILED." >&2; + exit 1 +fi +EOF_OUTER |