-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.bats
More file actions
executable file
·53 lines (40 loc) · 950 Bytes
/
tests.bats
File metadata and controls
executable file
·53 lines (40 loc) · 950 Bytes
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
#!/usr/bin/env bats
function test_case() {
local _setup_file="tests/$1.setup.env"
local _test_file="tests/$1.env"
local _expected_output="tests/$1.json"
# setup cleans the environment of the unexpected
. "$_setup_file"
# args after the first two are passed through verbatim
shift
echo "$@"
# sort and remove `meta` before comparison with expected output
./bash-env-json "$@" "$_test_file" | jq --sort-keys 'del(.meta)' | diff -w - "$_expected_output"
}
@test "empty" {
test_case empty
}
@test "shell-functions" {
test_case shell-functions
}
@test "shell-variables" {
test_case shell-variables
}
@test "simple" {
test_case simple
}
@test "single" {
test_case single
}
@test "ming-the-merciless" {
test_case "Ming's menu of (merciless) monstrosities"
}
@test "multiline-string" {
test_case multiline-string
}
@test "error" {
test_case error
}
@test "shell-function-error" {
test_case shell-function-error --shellfns f
}