summaryrefslogtreecommitdiff
path: root/t/t0000-basic.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-xt/t0000-basic.sh39
1 files changed, 34 insertions, 5 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 3e440c078d..90bf1dbc8d 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -77,9 +77,7 @@ _run_sub_test_lib_test_common () {
# the sub-test.
sane_unset HARNESS_ACTIVE &&
cd "$name" &&
- cat >"$name.sh" <<-EOF &&
- #!$SHELL_PATH
-
+ write_script "$name.sh" "$TEST_SHELL_PATH" <<-EOF &&
test_description='$descr (run in sub test-lib)
This is run in a sub test-lib so that we do not get incorrect
@@ -94,15 +92,15 @@ _run_sub_test_lib_test_common () {
. "\$TEST_DIRECTORY"/test-lib.sh
EOF
cat >>"$name.sh" &&
- chmod +x "$name.sh" &&
export TEST_DIRECTORY &&
TEST_OUTPUT_DIRECTORY=$(pwd) &&
export TEST_OUTPUT_DIRECTORY &&
+ sane_unset GIT_TEST_FAIL_PREREQS &&
if test -z "$neg"
then
./"$name.sh" "$@" >out 2>err
else
- ! ./"$name.sh" "$@" >out 2>err
+ ! ./"$name.sh" "$@" >out 2>err
fi
)
}
@@ -833,6 +831,19 @@ then
exit 1
fi
+test_expect_success 'lazy prereqs do not turn off tracing' "
+ run_sub_test_lib_test lazy-prereq-and-tracing \
+ 'lazy prereqs and -x' -v -x <<-\\EOF &&
+ test_lazy_prereq LAZY true
+
+ test_expect_success lazy 'test_have_prereq LAZY && echo trace'
+
+ test_done
+ EOF
+
+ grep 'echo trace' lazy-prereq-and-tracing/err
+"
+
test_expect_success 'tests clean up even on failures' "
run_sub_test_lib_test_err \
failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
@@ -1260,4 +1271,22 @@ test_expect_success 'very long name in the index handled sanely' '
test $len = 4098
'
+test_expect_success 'test_must_fail on a failing git command' '
+ test_must_fail git notacommand
+'
+
+test_expect_success 'test_must_fail on a failing git command with env' '
+ test_must_fail env var1=a var2=b git notacommand
+'
+
+test_expect_success 'test_must_fail rejects a non-git command' '
+ ! test_must_fail grep ^$ notafile 2>err &&
+ grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
+'
+
+test_expect_success 'test_must_fail rejects a non-git command with env' '
+ ! test_must_fail env var1=a var2=b grep ^$ notafile 2>err &&
+ grep -F "test_must_fail: only '"'"'git'"'"' is allowed" err
+'
+
test_done