summaryrefslogtreecommitdiff
path: root/tests/t0013-include-precedence.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/t0013-include-precedence.sh')
-rwxr-xr-xtests/t0013-include-precedence.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/t0013-include-precedence.sh b/tests/t0013-include-precedence.sh
new file mode 100755
index 0000000..0bfc1e5
--- /dev/null
+++ b/tests/t0013-include-precedence.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -eu
+dir="${TMPDIR-/tmp}/mcpu-cpp-precedence-$$"
+mkdir -p "$dir"
+trap 'rm -rf "$dir"' EXIT HUP INT TERM
+cat > "$dir/config" <<EOT
+MCPU_CPP_INCLUDE_PATH = $srcdir/data/common-precedence;
+MCPU_CPP_AS_INCLUDE_PATH = $srcdir/data/lang-as-precedence;
+EOT
+cat > "$dir/main.c" <<'EOT'
+#include <same.h>
+#lang "as"
+#include <same.h>
+#endlang
+EOT
+"$MCPU_CPP" --config-file "$dir/config" "$dir/main.c" -o "$dir/out"
+grep 'from_common_include_root' "$dir/out" >/dev/null
+grep 'from_as_specific_include_path' "$dir/out" >/dev/null