-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgobash_test.sh
67 lines (51 loc) · 1.4 KB
/
gobash_test.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# https://github.com./EngineeringSoftware/gobash/blob/main/LICENSE
#
# Tests for the gobash module.
if [ -n "${GOBASH_TEST_MOD:-}" ]; then return 0; fi
readonly GOBASH_TEST_MOD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. ${GOBASH_TEST_MOD}/gobash
# ----------
# Functions.
function test_gobash_help() {
gobash_help > /dev/null || \
assert_fail
}
readonly -f test_gobash_help
function test_gobash_func() {
gobash_func > /dev/null && \
assert_fail
gobash_func sys_version > /dev/null || \
assert_fail
}
readonly -f test_gobash_func
function test_gobash_test() {
gobash_test > /dev/null && \
assert_fail
return 0
}
readonly -f test_gobash_test
function test_gobash_lint() {
gobash_lint "${BASH_SOURCE[0]}" > /dev/null && \
assert_fail
return 0
}
readonly -f test_gobash_lint
# function test_gobash_doc() {
# :
# }
# readonly -f test_gobash_doc
function test_gobash_version() {
gobash_version > /dev/null || \
assert_fail
}
readonly -f test_gobash_version
function test_gobash_ctx() {
local ctx=$(ctx_make)
main $ctx test | grep 'has to be provided' > /dev/null || \
assert_fail
ctx_show $ctx | grep 'arguments do not pass check' || \
assert_fail
}
readonly -f test_gobash_ctx