tests
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Helper to detect regressions in load's lookup ordering.
|
||||
# An exact name match should be prioritized over name.bash.
|
||||
|
||||
echo "Should not have loaded this file!" >&2
|
||||
exit 1
|
||||
@@ -0,0 +1,6 @@
|
||||
# Helper to detect regressions in load's lookup ordering.
|
||||
# An exact name match should be prioritized over name.bash.
|
||||
|
||||
echo "This is the expected file to load."
|
||||
|
||||
help_me() { :; }
|
||||
@@ -0,0 +1,6 @@
|
||||
[ -n "${HELPER_NAME:-}" ] || HELPER_NAME="test_helper"
|
||||
bats_load_library "$HELPER_NAME"
|
||||
|
||||
@test "calling a loaded helper" {
|
||||
help_me
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
exit 1
|
||||
@@ -0,0 +1,5 @@
|
||||
bats_load_library "return1"
|
||||
|
||||
@test "true" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
load "return1"
|
||||
|
||||
@test "true" {
|
||||
true
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@test "find a library" {
|
||||
run find_in_bats_lib_path "$LIBRARY_NAME"
|
||||
[ $status -eq 0 ]
|
||||
[ "${lines[0]}" = "$LIBRARY_PATH" ]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
@test "does not find a library" {
|
||||
run find_in_bats_lib_path "$LIBRARY_NAME"
|
||||
[ $status -eq 1 ]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
[ -n "${HELPER_NAME:-}" ] || HELPER_NAME="test_helper"
|
||||
load "$HELPER_NAME"
|
||||
|
||||
@test "calling a loaded helper" {
|
||||
help_me
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
teardown() {
|
||||
load 'test_helper'
|
||||
}
|
||||
|
||||
@test failed {
|
||||
false
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
return 1
|
||||
@@ -0,0 +1,19 @@
|
||||
help_me() {
|
||||
true
|
||||
}
|
||||
|
||||
failing_helper() {
|
||||
false
|
||||
}
|
||||
|
||||
return_0() {
|
||||
# Just return 0. Intentional assignment to boost line numbers
|
||||
result=0
|
||||
return $result
|
||||
}
|
||||
|
||||
return_1() {
|
||||
# Just return 0. Intentional assignment to boost line numbers
|
||||
result=1
|
||||
return $result
|
||||
}
|
||||
Reference in New Issue
Block a user