-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.sh
executable file
·63 lines (49 loc) · 1.55 KB
/
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
#!/bin/bash
# shellcheck shell=bash
# Run this file to run all the tests, once
shellcheck_fail() {
local file="$1"
printf '\n'
printf 'FAIL: "%s" did not pass shellcheck analysis\n' "$file"
printf ' Address the issues above and try again.\n'
exit 1
}
shellcheck_pass() {
printf 'PASS: shellcheck analysis\n\n'
}
shellcheck_module() {
shellcheck test.sh || shellcheck_fail "test.sh"
shellcheck -x bin/repl || shellcheck_fail "repl"
shellcheck modules/repl_modules.sh || shellcheck_fail "repl_modules.sh"
shellcheck language_support.sh || shellcheck_fail "language_support.sh"
shellcheck -e SC2034,SC2148 config || shellcheck_fail "config"
shellcheck -e SC2034,SC2148 config.default || shellcheck_fail "config.default"
shellcheck install.sh || shellcheck_fail "install.sh"
}
shellcheck_module_travis() {
shellcheck test.sh
shellcheck -x repl
shellcheck modules/repl_modules.sh
shellcheck language_support.sh
shellcheck -e SC2034,SC2148 config
shellcheck -e SC2034,SC2148 config.default
shellcheck install.sh
}
main() {
printf 'PRELIMINARY ANALYSIS...\n\n'
if ! type "shellcheck" > /dev/null 2>&1; then
printf 'Error: shellcheck is not installed\n'
printf 'Please install shellcheck first then try again\n'
exit 1
fi
shellcheck_module
shellcheck_pass
printf '###################\n\n'
printf 'SHUNIT2-TESTING...\n\n'
bash "./test/main_test.sh" || exit 1
printf '\n'
bash "./test/modules_test.sh" || exit 1
printf '\n'
printf 'Nice, %s, all tests are passing!\n' "$(git config user.name)"
}
main