summaryrefslogtreecommitdiff
path: root/t/README
diff options
context:
space:
mode:
authorLibravatar Jens Lehmann <Jens.Lehmann@web.de>2012-01-17 22:04:31 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-01-17 15:15:35 -0800
commitc4d2539af751ed394ee68c02fe688e75c647c5fe (patch)
treecb9658bddd4e0ff8d5c47ae4bfef7dd94255bf1e /t/README
parentMerge branch 'jk/maint-do-not-feed-stdin-to-tests' (diff)
downloadtgif-c4d2539af751ed394ee68c02fe688e75c647c5fe.tar.xz
test-lib: add the test_pause convenience function
Since 781f76b15 (test-lib: redirect stdin of tests) you can't simply put a "bash &&" into a test for debugging purposes anymore. Instead you'll have to use "bash <&6 >&3 2>&4". As that invocation is not that easy to remember add the test_pause convenience function. It invokes "$SHELL_PATH" to provide a sane shell for the user. This function also checks if the -v flag is given and will error out if that is not the case instead of letting the test hang until ^D is pressed. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/README')
-rw-r--r--t/README13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/README b/t/README
index c85abaffb3..c09c582c16 100644
--- a/t/README
+++ b/t/README
@@ -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
-------------