Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bats-core/bats-assert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Karns <jason@karns.name>2019-01-29 19:32:04 +0300
committerJason Karns <jason@karns.name>2019-01-29 19:32:05 +0300
commitbcbc5680274d1c3eb7cea16b21e62568136612d4 (patch)
tree86cb6783dc75c8a543e5959246ce1b14b52a9a6d /test
parente1b1378a7a1bc6501d932cb4fe70de1fdf15e9e0 (diff)
Unwrap setup
The test helper file itself is already sourced once per file test so this change doesn't change behavior. However, it frees up "setup" to be used more semantically by individual test files.
Diffstat (limited to 'test')
-rw-r--r--test/test_helper.bash34
1 files changed, 16 insertions, 18 deletions
diff --git a/test/test_helper.bash b/test/test_helper.bash
index 1461696..4c17202 100644
--- a/test/test_helper.bash
+++ b/test/test_helper.bash
@@ -1,25 +1,23 @@
-setup() {
- export TEST_MAIN_DIR="${BATS_TEST_DIRNAME}/.."
- export TEST_DEPS_DIR="${TEST_DEPS_DIR-${TEST_MAIN_DIR}/..}"
+export TEST_MAIN_DIR="${BATS_TEST_DIRNAME}/.."
+export TEST_DEPS_DIR="${TEST_DEPS_DIR-${TEST_MAIN_DIR}/..}"
- # Load dependencies.
- load "${TEST_DEPS_DIR}/bats-support/load.bash"
+# Load dependencies.
+load "${TEST_DEPS_DIR}/bats-support/load.bash"
- # Load library.
- load '../load'
+# Load library.
+load '../load'
- assert_test_pass() {
- test "$status" -eq 0
- test "${#lines[@]}" -eq 0
- }
+assert_test_pass() {
+ test "$status" -eq 0
+ test "${#lines[@]}" -eq 0
+}
- assert_test_fail() {
- local err_msg="${1-$(cat -)}"
- local num_lines="$(printf '%s' "$err_msg" | wc -l)"
+assert_test_fail() {
+ local err_msg="${1-$(cat -)}"
+ local num_lines="$(printf '%s' "$err_msg" | wc -l)"
- test "$status" -eq 1
- test "${#lines[@]}" -eq "$num_lines"
- test "$output" == "$err_msg"
- }
+ test "$status" -eq 1
+ test "${#lines[@]}" -eq "$num_lines"
+ test "$output" == "$err_msg"
}