]> git.notmuchmail.org Git - notmuch/commitdiff
test: Clear test-output output file before running Emacs tests
authorAustin Clements <amdragon@MIT.EDU>
Sat, 29 Sep 2012 17:55:12 +0000 (13:55 -0400)
committerDavid Bremner <bremner@debian.org>
Sun, 30 Sep 2012 14:40:22 +0000 (11:40 -0300)
Most Emacs tests end with a call to (test-output), which saves the
buffer to a filed called OUTPUT.  Previously, if the test code failed
with an exception before this call, the test framework would then
compare against the OUTPUT file from the last Emacs test, resulting in
confusing diffs.

This requires one tweak to an emacs test that made two calls to
test_emacs and expected an OUTPUT file from the first call.  We simply
reverse the order of the test_emacs calls.

test/emacs
test/test-lib.sh

index 5d118b67b4d347ae34242ba36cdc0051c2ebd799..174a9ac9260212f3a6c1a9d159eee0eb5dec76c9 100755 (executable)
@@ -653,6 +653,8 @@ test_expect_equal "$(cat OUTPUT)" "thread:XXX"
 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
+test_emacs "(notmuch-show \"$message2\")
+           (test-output \"EXPECTED\")"
 test_emacs "(notmuch-search \"$message1 or $message2\")
            (notmuch-test-wait)
            (notmuch-search-show-thread)
 test_emacs "(notmuch-search \"$message1 or $message2\")
            (notmuch-test-wait)
            (notmuch-search-show-thread)
@@ -660,8 +662,6 @@ test_emacs "(notmuch-search \"$message1 or $message2\")
            (redisplay)
            (notmuch-show-advance-and-archive)
            (test-output)"
            (redisplay)
            (notmuch-show-advance-and-archive)
            (test-output)"
-test_emacs "(notmuch-show \"$message2\")
-           (test-output \"EXPECTED\")"
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Refresh show buffer"
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Refresh show buffer"
index f34b1fb86af15eb89b91c328e2558d0f0eb8207b..7448b454a023231947688a542d701438728b8497 100644 (file)
@@ -985,6 +985,14 @@ test_emacs () {
                done
        fi
 
                done
        fi
 
+       # Clear test-output output file.  Most Emacs tests end with a
+       # call to (test-output).  If the test code fails with an
+       # exception before this call, the output file won't get
+       # updated.  Since we don't want to compare against an output
+       # file from another test, so start out with an empty file.
+       rm -f OUTPUT
+       touch OUTPUT
+
        emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
 }
 
        emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
 }