diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:53 -0800 |
commit | 26ad2168a1cae9a8c24acf2b65ba978801958076 (patch) | |
tree | bc7854caa38d2d2b3f86114d224ad3461f9dc342 | |
parent | bff64a9cdabee8476ad1d2e45f586a2d6a884363 (diff) | |
parent | c4d2539af751ed394ee68c02fe688e75c647c5fe (diff) | |
download | git-26ad2168a1cae9a8c24acf2b65ba978801958076.tar.gz |
Merge branch 'jl/test-pause'
* jl/test-pause:
test-lib: add the test_pause convenience function
-rw-r--r-- | t/README | 13 | ||||
-rw-r--r-- | t/test-lib.sh | 13 |
2 files changed, 26 insertions, 0 deletions
@@ -548,6 +548,19 @@ library for your script to use. ... ' + - test_pause + + This command is useful for writing and debugging tests and must be + removed before submitting. It halts the execution of the test and + spawns a shell in the trash directory. Exit the shell to continue + the test. Example: + + test_expect_success 'test' ' + git do-something >actual && + test_pause && + test_cmp expected actual + ' + Prerequisites ------------- diff --git a/t/test-lib.sh b/t/test-lib.sh index a65dfc7ea9..709a30067e 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -329,6 +329,19 @@ test_tick () { export GIT_COMMITTER_DATE GIT_AUTHOR_DATE } +# Stop execution and start a shell. This is useful for debugging tests and +# only makes sense together with "-v". +# +# Be sure to remove all invocations of this command before submitting. + +test_pause () { + if test "$verbose" = t; then + "$SHELL_PATH" <&6 >&3 2>&4 + else + error >&5 "test_pause requires --verbose" + fi +} + # Call test_commit with the arguments "<message> [<file> [<contents>]]" # # This will commit a file with the given contents and the given commit |