aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/030.sh
blob: e444938eba41ad9f74dd9c029b2ad479e9fffb68 (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
53
set -e

cat <<'EOF' > expected
foo
EOF
bash ../../test_diff.sh <<'EOF'
int printf();

int foo() {
    printf("foo\n");
    return 0;
}

int bar() {
    printf("bar\n");
    return 1;
}

int main() {
    if (foo() && bar()) {
        printf("baz\n");
    }

    return 0;
}
EOF

cat <<'EOF' > expected
foo
bar
baz
EOF
bash ../../test_diff.sh <<'EOF'
int printf();

int foo() {
    printf("foo\n");
    return 0;
}

int bar() {
    printf("bar\n");
    return 1;
}

int main() {
    if (foo() || bar()) {
        printf("baz\n");
    }

    return 0;
}
EOF