diff options
Diffstat (limited to 'tests/t0027-system-language-path.sh')
| -rwxr-xr-x | tests/t0027-system-language-path.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/t0027-system-language-path.sh b/tests/t0027-system-language-path.sh new file mode 100755 index 0000000..0947c07 --- /dev/null +++ b/tests/t0027-system-language-path.sh @@ -0,0 +1,44 @@ +#!/bin/sh +set -eu +base="${TMPDIR-/tmp}/mcpu-cpp-system-lang-$$" +mkdir -p "$base/system/diff" "$base/system/as" +trap 'rm -rf "$base"' EXIT HUP INT TERM + +cat > "$base/test.conf" <<EOT +MCPU_CPP_SYSTEM_INCLUDE_PATH = $base/system; +EOT + +cat > "$base/system/common.h" <<'EOT' +common_system_header +EOT +cat > "$base/system/diff/lang.h" <<'EOT' +diff_system_header +EOT +cat > "$base/system/as/lang.h" <<'EOT' +as_system_header +EOT +cat > "$base/system/diff/explicit.h" <<'EOT' +explicit_diff_system_header +EOT + +cat > "$base/main.c" <<'EOT' +#include <common.h> +#lang "diff" +#include <lang.h> +#endlang +#lang "as" +#include <lang.h> +#include <diff/explicit.h> +#endlang +EOT + +"$MCPU_CPP" --config-file "$base/test.conf" "$base/main.c" -o "$base/out" + +grep '^common_system_header$' "$base/out" >/dev/null +grep '^diff_system_header$' "$base/out" >/dev/null +grep '^as_system_header$' "$base/out" >/dev/null +grep '^explicit_diff_system_header$' "$base/out" >/dev/null + +if "$MCPU_CPP" --config-file "$base/test.conf" -nostdinc "$base/main.c" -o "$base/no" 2>/dev/null; then + exit 1 +fi |
