]> git.notmuchmail.org Git - notmuch/blobdiff - test/notmuch-test
test: When a test fails, show diff only (save complete output to a file)
[notmuch] / test / notmuch-test
index f0c0aad6ea6cb4ecfc723198d77b27fc1931c092..676b66ec76b822de914a34bd0e66bef2c6a4f35d 100755 (executable)
@@ -94,7 +94,7 @@ generate_message ()
     fi
 
     if [ -z "${template[body]}" ]; then
-       template[body]="This is just test message (#${gen_msg_cnt})"
+       template[body]="This is just test message (#${gen_msg_cnt})"
     fi
 
     if [ -z "${template[from]}" ]; then
@@ -168,8 +168,10 @@ pass_if_equal ()
        echo "  PASS"
     else
        echo "  FAIL"
-       echo "  Expected output: $expected"
-       echo "  Actual output:   $output"
+       testname=test-$(printf "%03d" $tests)
+       echo "$expected" > $testname.expected
+       echo "$output" > $testname.output
+       diff -u $testname.expected $testname.output || true
        test_failures=$((test_failures + 1))
     fi
 }