author | Junio C Hamano <gitster@pobox.com> | |
Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 29 Jan 2012 21:18:53 +0000 (13:18 -0800) |
* jl/test-pause:
test-lib: add the test_pause convenience function
test-lib: add the test_pause convenience function
t/README | patch | blob | history | |
t/test-lib.sh | patch | blob | history |
diff --git a/t/README b/t/README
index c85abaffb3b8c2142e87f6e0525fa67c6b62c1a1..c09c582c163dd547ed5b1d7a65e13e3345bb7eca 100644 (file)
--- a/t/README
+++ b/t/README
...
'
+ - 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 a65dfc7ea93b3ec95e6ab7cd5b758029fe599d22..709a30067e5486526095cad98c4ade7334613fc8 100644 (file)
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
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