blob: 13b5753b56a359e321f4eaf27c1b05c31f37510e (
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
|
#!/usr/bin/env bash
set -eu
exe=${1:?First argument must be the executable to test}
root="$(cd "${0%/*}" && pwd)"
# shellcheck disable=1090
source "$root/utilities.sh"
snapshot="$root/snapshots"
SUCCESSFULLY=0
WITH_FAILURE=1
(with "no input file"
it "fails with an error message" && {
WITH_SNAPSHOT="$snapshot/failure-missing-input-file" \
expect_run ${WITH_FAILURE} "$exe"
}
)
(with "a valid input file"
it "produces the expected output" && {
WITH_SNAPSHOT="$snapshot/success-input-file-produces-correct-output" \
expect_run ${SUCCESSFULLY} "$exe" <(echo this is probably not what you want)
}
)
|