summaryrefslogtreecommitdiff
path: root/tests/t0016-macro-include.sh
blob: 0c1b56e08906effeb6086c2883dfc478fae778b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
set -eu
base="${TMPDIR-/tmp}/mcpu-cpp-minclude-$$"
mkdir -p "$base/inc"
trap 'rm -rf "$base"' EXIT HUP INT TERM
cat > "$base/main.c" <<'EOT'
#define HEADER <macro.h>
#include HEADER
VALUE
EOT
cat > "$base/inc/macro.h" <<'EOT'
#define VALUE 77
EOT
"$MCPU_CPP" --no-config -I "$base/inc" "$base/main.c" -o "$base/out"
grep '^77$' "$base/out" >/dev/null
grep "^# 3 \"$base/main.c\" 2$" "$base/out" >/dev/null