From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 28868431E64 for ; Tue, 31 Jan 2012 23:21:11 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 95Loiri3Irfb for ; Tue, 31 Jan 2012 23:21:10 -0800 (PST) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 42FF2431FAF for ; Tue, 31 Jan 2012 23:21:10 -0800 (PST) Received: by bke11 with SMTP id 11so817306bke.26 for ; Tue, 31 Jan 2012 23:21:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; bh=iD0SGwyFbNav9t1BddkGbRV4n4UbIJzo3hLAHRZzkSo=; b=KCSPbRZ/5yJp3A5n3inzP5F6xl7DUQy40GYtr2XdDug29Gr0qJwjJcPbZb7EVJtXFh GOu9dXXq8d3tXUz+x5ufPIKcekQFOwHp2OnLIPWTzJQe7TJ5hXVqVXnadV81GRRcqBbO pwGpBDNTDQi4umcrTakpCMV65ltmN5lETrYRw= Received: by 10.204.133.201 with SMTP id g9mr12403655bkt.137.1328080867433; Tue, 31 Jan 2012 23:21:07 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id ga13sm51760580bkc.5.2012.01.31.23.21.06 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 Jan 2012 23:21:07 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH] test: make test_expect_equal_file() arguments flexible Date: Wed, 1 Feb 2012 11:19:54 +0400 Message-Id: <1328080794-24670-1-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.9 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2012 07:21:11 -0000 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 | 10 +++++----- test/test-lib.sh | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/README b/test/README index 43656a3..e0364e8 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