author | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Jul 2010 18:29:30 +0000 (11:29 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Jul 2010 18:29:30 +0000 (11:29 -0700) |
* maint:
t/README: clarify test_must_fail description
Check size of path buffer before writing into it
Conflicts:
t/README
t/README: clarify test_must_fail description
Check size of path buffer before writing into it
Conflicts:
t/README
1 | 2 | |||
---|---|---|---|---|
setup.c | patch | | diff1 | | diff2 | | blob | history |
t/README | patch | | diff1 | | diff2 | | blob | history |
diff --cc setup.c
Simple merge
diff --cc t/README
index b906ceb4766a283ae6b22bd037f9e1619feb12d1,fecb76e599cee2643e4f6c05c44fa2585e807284..a5901424388b9cfb525b7bdbfd6d5afda3c9e014
+++ b/t/README
- test_must_fail <git-command>
Run a git command and ensure it fails in a controlled way. Use
- this instead of "! <git-command>" to fail when git commands
- segfault.
+ this instead of "! <git-command>". When git-command dies due to a
+ segfault, test_must_fail diagnoses it as an error; "! <git-command>"
+ treats it as just another expected failure, which would let such a
+ bug go unnoticed.
+ - test_might_fail <git-command>
+
+ Similar to test_must_fail, but tolerate success, too. Use this
+ instead of "<git-command> || :" to catch failures due to segv.
+
+ - test_cmp <expected> <actual>
+
+ Check whether the content of the <actual> file matches the
+ <expected> file. This behaves like "cmp" but produces more
+ helpful output when the test is run with "-v" option.
+
+ - test_when_finished <script>
+
+ Prepend <script> to a list of commands to run to clean up
+ at the end of the current test. If some clean-up command
+ fails, the test will not pass.
+
+ Example:
+
+ test_expect_success 'branch pointing to non-commit' '
+ git rev-parse HEAD^{tree} >.git/refs/heads/invalid &&
+ test_when_finished "git update-ref -d refs/heads/invalid" &&
+ ...
+ '
+
+
Tips for Writing Tests
----------------------