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

github.com/bats-core/bats-support.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/50-output-10-batslib_err.bats')
-rwxr-xr-xtest/50-output-10-batslib_err.bats27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/50-output-10-batslib_err.bats b/test/50-output-10-batslib_err.bats
index 8c27fd1..89b9db1 100755
--- a/test/50-output-10-batslib_err.bats
+++ b/test/50-output-10-batslib_err.bats
@@ -14,3 +14,30 @@ load test_helper
[ "$status" -eq 0 ]
[ "$output" == 'm1 m2' ]
}
+
+@test 'batslib_err() works with modified path' {
+ export PATH="$BATS_TEST_DIRNAME:$PATH"
+ echo 'm1 m2' | {
+ # Verify stub
+ run which cat
+ [ "$status" -eq 0 ]
+ [ "$output" = "$BATS_TEST_DIRNAME/cat" ]
+ # Should still work
+ run batslib_err
+ [ "$status" -eq 0 ]
+ [ "$output" == 'm1 m2' ]
+ }
+}
+
+@test 'batslib_err() works with mock function' {
+ echo 'm1 m2' | {
+ function cat {
+ echo "Mocked cat"
+ }
+ [ "$(cat)" = "Mocked cat" ]
+ # Should still work
+ run batslib_err
+ [ "$status" -eq 0 ]
+ [ "$output" == 'm1 m2' ]
+ }
+}