Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 94FEE431FAF for ; Wed, 1 Feb 2012 16:05:29 -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 rSNzXOSjC65R for ; Wed, 1 Feb 2012 16:05:29 -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 E7AE9431FAE for ; Wed, 1 Feb 2012 16:05:28 -0800 (PST) Received: by mail-bk0-f53.google.com with SMTP id 11so1737569bke.26 for ; Wed, 01 Feb 2012 16:05:28 -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:in-reply-to:references; bh=i76hdNGeWU6YSpkK7FOJa2vXgmsRE1aioGTE8R2OmLk=; b=xV5EMcEpfd20UATDj0ylKwZ4exwGk8Ws1VfxVsh6+j37Kwk2pmZusagKKsKhu4fgnM ThUewoz/DELnaBEmCxBp6gAuXQERTyL/iaL9btYY0O47p+956BppJQtfDqLnfIxlHtge BbBn8yaxV8AnWT2gdZxlB+6fLOdDgKLkm7PNo= Received: by 10.204.136.220 with SMTP id s28mr233826bkt.59.1328141128681; Wed, 01 Feb 2012 16:05:28 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id bw9sm1562946bkb.8.2012.02.01.16.05.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Feb 2012 16:05:28 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH 1/2] test: add check for filename argument for test_expect_equal_file Date: Thu, 2 Feb 2012 04:04:09 +0400 Message-Id: <1328141050-30356-2-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1328141050-30356-1-git-send-email-dmitry.kurochkin@gmail.com> 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: Thu, 02 Feb 2012 00:05:29 -0000 Test_expect_equal_file() function treats 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 is 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 requires the filename argument for test_expect_equal_file() function to contain 'EXPECT' or 'expect' substring. Otherwise test fails with appropriate error. This allows us to easily catch argument order errors during test development. Most tests already comply with the required format. But there are some tests which are broken by this change. Notably, the tests which have wrong argument order for test_expect_equal_file() fail after the change, which kind of proofs the idea. --- test/README | 3 ++- test/test-lib.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/test/README b/test/README index 43656a3..0105019 100644 --- a/test/README +++ b/test/README @@ -181,7 +181,8 @@ library for your script to use. 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. + also notices whitespace and closing newline differences. The + file name must contain 'expect' or 'EXPECT' substring. test_debug