mirror of
https://github.com/sstephenson/bats.git
synced 2025-03-03 07:19:45 +01:00
Add test harness for various library loading methods
This commit is contained in:
parent
617e086a26
commit
cb434296c5
21
test/fixtures/bats/load.bats
vendored
21
test/fixtures/bats/load.bats
vendored
|
@ -1,6 +1,27 @@
|
|||
[ -n "$HELPER_NAME" ] || HELPER_NAME="test_helper"
|
||||
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" {
|
||||
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
|
||||
}
|
||||
|
|
3
test/fixtures/bats/load_path/no_loader/no_loader.bash
vendored
Normal file
3
test/fixtures/bats/load_path/no_loader/no_loader.bash
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
no_loader() {
|
||||
true
|
||||
}
|
3
test/fixtures/bats/load_path/single_file.bash
vendored
Normal file
3
test/fixtures/bats/load_path/single_file.bash
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
lib_func() {
|
||||
true
|
||||
}
|
1
test/fixtures/bats/load_path/with_loader.bash
vendored
Normal file
1
test/fixtures/bats/load_path/with_loader.bash
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
source "$(dirname ${BASH_SOURCE[0]})/with_loader/a-file.bash"
|
3
test/fixtures/bats/load_path/with_loader/a-file.bash
vendored
Normal file
3
test/fixtures/bats/load_path/with_loader/a-file.bash
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
with_loader() {
|
||||
true
|
||||
}
|
Loading…
Reference in New Issue
Block a user