]> git.notmuchmail.org Git - notmuch/commit
test: make test_expect_equal_file() arguments flexible
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 1 Feb 2012 07:19:54 +0000 (11:19 +0400)
committerDavid Bremner <bremner@debian.org>
Sun, 2 Sep 2012 02:09:26 +0000 (23:09 -0300)
commit1ffb38296121f8cdec3f4193b8f3d31495a652ec
treececc6b1985f9dd227fcc1c91f3090998a545fb54
parentc62126238b2ce6194b3c6511553951497aedf295
test: make test_expect_equal_file() arguments flexible

Before the change, test_expect_equal_file() function treated the first
argument as "actual output file" and the second argument as "expected
output file".  When the test fails, the files are copied for later
inspection.  The first files was copied to "$testname.output" and the
second file to "$testname.expected".  The argument order for
test_expect_equal_file() is often wrong which results in confusing
diff output and incorrectly named files.

The patch solves the issue by changing test_expect_equal_file() to
treat arguments just as two files, without any special properties
(like "actual" and "expected").  The file names for copying is now
based on the given file name: "$testname.$file1" and
"$testname.$file2".  E.g. if test_expect_equal_file() is called with
"OUTPUT" and "EXPECTED", the copied files can be named
"emacs.1.OUTPUT" and "emacs.1.EXPECTED".

The down side of this approach is that diff argument order depends on
test_expect_equal_file() argument order.  So sometimes we get diff
from expected to actual results, and sometimes the other way around.
But the files are always named correctly.
test/README
test/test-lib.sh