aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-24 23:18:32 +0900
committernsfisis <nsfisis@gmail.com>2025-08-24 23:55:28 +0900
commit78f961696c3bd761c9f43e368765055e33834b90 (patch)
treeb6eb4514d1c4cf997f4cc92cfc7de594566d701e /tests
parentc8851cbda7da8ff579efb6603d2dff2576768863 (diff)
downloadducc-78f961696c3bd761c9f43e368765055e33834b90.tar.gz
ducc-78f961696c3bd761c9f43e368765055e33834b90.tar.zst
ducc-78f961696c3bd761c9f43e368765055e33834b90.zip
feat: resolve include name relative to the current file name
Diffstat (limited to 'tests')
-rw-r--r--tests/055.sh39
-rw-r--r--tests/057.sh2
2 files changed, 36 insertions, 5 deletions
diff --git a/tests/055.sh b/tests/055.sh
index 6fc3608..997f12b 100644
--- a/tests/055.sh
+++ b/tests/055.sh
@@ -1,7 +1,3 @@
-cat <<'EOF' > expected
-8
-EOF
-
cat <<'EOF' > header.h
int add(int a, int b) {
return a + b;
@@ -10,6 +6,9 @@ int add(int a, int b) {
int printf(const char*, ...);
EOF
+cat <<'EOF' > expected
+8
+EOF
test_diff <<'EOF'
#include "header.h"
@@ -18,3 +17,35 @@ int main() {
return 0;
}
EOF
+
+mkdir -p foo
+cat <<'EOF' > bar.h
+#include "baz.h"
+EOF
+cat <<'EOF' > baz.h
+#define A 123
+EOF
+cat <<'EOF' > foo/bar.h
+#include "baz.h"
+EOF
+cat <<'EOF' > foo/baz.h
+#define A 456
+EOF
+
+cat <<'EOF' > expected
+123
+456
+EOF
+test_diff <<'EOF'
+int printf(const char*, ...);
+
+int main() {
+#include "bar.h"
+ printf("%d\n", A);
+
+#undef A
+
+#include "foo/bar.h"
+ printf("%d\n", A);
+}
+EOF
diff --git a/tests/057.sh b/tests/057.sh
index 8850e55..291030c 100644
--- a/tests/057.sh
+++ b/tests/057.sh
@@ -1,5 +1,5 @@
cat <<'EOF' > expected
-cannot open include file: nonexistent.h
+cannot open include file: ./nonexistent.h
EOF
test_compile_error <<'EOF'