diff options
Diffstat (limited to 'tests/t0014-preprocessing-phases.sh')
| -rwxr-xr-x | tests/t0014-preprocessing-phases.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/t0014-preprocessing-phases.sh b/tests/t0014-preprocessing-phases.sh new file mode 100755 index 0000000..5cc98c8 --- /dev/null +++ b/tests/t0014-preprocessing-phases.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -eu +src="${TMPDIR-/tmp}/mcpu-cpp-phases-$$.c" +out="${TMPDIR-/tmp}/mcpu-cpp-phases-$$.out" +trap 'rm -f "$src" "$out"' EXIT HUP INT TERM +cat > "$src" <<'EOT' +#defi\ +ne VALUE 10\ +20 +/* comment */ VALUE // trailing comment +const char *s = "VALUE /* not a comment */"; +EOT +"$MCPU_CPP" --no-config "$src" -o "$out" +grep '1020' "$out" >/dev/null +grep 'VALUE /\* not a comment \*/' "$out" >/dev/null +if grep 'trailing comment' "$out" >/dev/null; then + exit 1 +fi +if grep '/\* comment \*/' "$out" >/dev/null; then + exit 1 +fi |
