From: Dmitry Kurochkin Date: Wed, 1 Feb 2012 07:19:54 +0000 (+0400) Subject: test: make test_expect_equal_file() arguments flexible X-Git-Tag: 0.15_rc1~254 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1ffb38296121f8cdec3f4193b8f3d31495a652ec;p=notmuch.git 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. --- diff --git a/test/README b/test/README index 43656a35..e0364e86 100644 --- a/test/README +++ b/test/README @@ -176,12 +176,12 @@ library for your script to use. will generate a failure and print the difference of the two strings. - test_expect_equal_file + test_expect_equal_file - Identical to test_exepect_equal, except that and - are files instead of strings. This is a much more - robust method to compare formatted textual information, since it - also notices whitespace and closing newline differences. + Identical to test_exepect_equal, except that and + are files instead of strings. This is a much more robust method to + compare formatted textual information, since it also notices + whitespace and closing newline differences. test_debug