blob: 997f12bf5ed5a3646b60c54b84922a63df82168d (
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
|
cat <<'EOF' > header.h
int add(int a, int b) {
return a + b;
}
int printf(const char*, ...);
EOF
cat <<'EOF' > expected
8
EOF
test_diff <<'EOF'
#include "header.h"
int main() {
printf("%d\n", add(5, 3));
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
|