aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/include_errors.sh
blob: 3ac546f6245391597cd9d956d476d1b731c6398f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cat <<'EOF' > expected
main.c:1: cannot open include file: "nonexistent.h"
EOF

test_compile_error <<'EOF'
#include "nonexistent.h"

int main() {
    return 0;
}
EOF

cat <<'EOF' > expected
include depth limit exceeded
EOF

# Create circular include files
cat <<'EOF' > a.h
#include "b.h"
int a() { return 1; }
EOF

cat <<'EOF' > b.h
#include "a.h"
int b() { return 2; }
EOF

test_compile_error <<'EOF'
#include "a.h"

int main() {
    a() + b();
    return 0;
}
EOF

cat <<'EOF' > expected
main.c:1: cannot open include file: "hoge.h"
EOF

test_compile_error <<'EOF'
#include "hoge.h"
EOF

cat <<'EOF' > expected
main.c:1: cannot resolve include file name: <hoge.h>
EOF

test_compile_error <<'EOF'
#include <hoge.h>
EOF