summaryrefslogtreecommitdiffstatshomepage
path: root/test/tst-lib.sh
blob: 8d7f876e4db448fa3eef54a778e8a750ee4efe15 (plain) (blame)
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
test_run() {
    mkdir -- "$test_root_dir/lib"
    cat > "$test_root_dir/lib/foo.sh" <<'EOF'
test_foo() {
    log foo
}

test_bar() {
    log bar
}
EOF
    cat > "$test_root_dir/lib/baz.sh" <<'EOF'
test_baz() {
    log baz
}
EOF

    cat > "$test_root_dir/$test_file" <<'EOF'
test_run() {
    test_foo
    test_bar
    test_baz
}
EOF

    local output
    output="$( test_run_harness )"

    test_check_harness_log "$output" "$test_file | foo"
    test_check_harness_log "$output" "$test_file | bar"
    test_check_harness_log "$output" "$test_file | baz"

    test_check_harness_summary "$output" 1 0
}