]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/README
fast-import: export correctly marks larger than 2^20-1
[git.git] / t / README
index 271f8684e959ca01e9f5bb2163f31eaae5733e2a..0d1183c3e69904e9e3543d757f14f10c629e199b 100644 (file)
--- a/t/README
+++ b/t/README
@@ -259,11 +259,11 @@ Do:
        test ...
 
    That way all of the commands in your tests will succeed or fail. If
-   you must ignore the return value of something (e.g. the return
-   value of export is unportable) it's best to indicate so explicitly
-   with a semicolon:
+   you must ignore the return value of something (e.g., the return
+   after unsetting a variable that was already unset is unportable) it's
+   best to indicate so explicitly with a semicolon:
 
-       export HLAGH;
+       unset HLAGH;
        git merge hla &&
        git push gh &&
        test ...
@@ -448,6 +448,39 @@ library for your script to use.
            'Perl API' \
            "$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl
 
+ - test_must_fail <git-command>
+
+   Run a git command and ensure it fails in a controlled way.  Use
+   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
 ----------------------