1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-11-17 11:42:33 +01:00

Add test harness for various library loading methods

This commit is contained in:
Nelo Wallus 2017-03-22 19:49:36 +01:00 committed by Nelo-T. Wallus
parent 617e086a26
commit cb434296c5
5 changed files with 31 additions and 0 deletions

View File

@ -1,6 +1,27 @@
[ -n "$HELPER_NAME" ] || HELPER_NAME="test_helper" [ -n "$HELPER_NAME" ] || HELPER_NAME="test_helper"
load "$HELPER_NAME" load "$HELPER_NAME"
BATS_LIB_PATH="$BATS_TEST_DIRNAME/load_path" \
load "${HELPER_LIB_SINGLE_FILE:-single_file}"
BATS_LIB_PATH="$BATS_TEST_DIRNAME/load_path" \
load "${HELPER_LIB_NO_LOADER:-no_loader}"
BATS_LIB_PATH="$BATS_TEST_DIRNAME/load_path" \
load "${HELPER_LIB_WITH_LOADER:-with_loader}"
@test "calling a loaded helper" { @test "calling a loaded helper" {
help_me help_me
} }
@test "calling a library helper" {
lib_func
}
@test "calling a helper from library without loading file" {
no_loader
}
@test "calling a helper from library with loading file" {
with_loader
}

View File

@ -0,0 +1,3 @@
no_loader() {
true
}

View File

@ -0,0 +1,3 @@
lib_func() {
true
}

View File

@ -0,0 +1 @@
source "$(dirname ${BASH_SOURCE[0]})/with_loader/a-file.bash"

View File

@ -0,0 +1,3 @@
with_loader() {
true
}