From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oGXHFMsKCGFp7QAAgWs5BA (envelope-from ) for ; Mon, 02 Aug 2021 17:10:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CJSPEMsKCGGYBgAA1q6Kng (envelope-from ) for ; Mon, 02 Aug 2021 15:10:03 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F349C7A1E for ; Mon, 2 Aug 2021 17:10:02 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id DDE682C06D; Mon, 2 Aug 2021 11:09:44 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 803352C04B for ; Mon, 2 Aug 2021 11:09:35 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 69E905FD5C; Mon, 2 Aug 2021 11:09:35 -0400 (EDT) Received: (nullmailer pid 3234750 invoked by uid 1000); Mon, 02 Aug 2021 15:09:30 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 3/8] test: factor out test_diff_file_ Date: Mon, 2 Aug 2021 12:09:17 -0300 Message-Id: <20210802150922.3234616-4-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210802150922.3234616-1-david@tethera.net> References: <87bl9lx864.fsf@kisara.moe> <20210802150922.3234616-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: VN7LPOJARPULZGHFSF5DNAB5QYXWYJ2Z X-Message-ID-Hash: VN7LPOJARPULZGHFSF5DNAB5QYXWYJ2Z X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1627917003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XdCU0PMV/8nSw9FSRGTH1+WBYyj2pVcSF+yOZFg9Mj0=; b=Edym22tboV2xys8xp93xvyL59jSzoW4WMbRUbU/VDFx3VcNNALEYM+lIelFAqbQNOUq17b Bn1vzqcGL0pNnXhFzBZrqKQyQzE0gd8f0cKNE+CwIfj1onMvkx0jBw926qLwIE1flBXHWr wuKdpxPhF4xO0t/91E6X8p4pzP4mgXDSPweVeeCEWvMMwlwuVKeYZDMyOHbo99XqiZow3o /eHUTY/UlfcfSzXZ5GmyZFaYorw+Kv3wGbZOmV9iNH9cBru8jCNyzkrPUxrECPXj94Hixs ly0Rbpj6Iy1FurndFBTqIlesJhwkgXq9zUype508usdU0u0VTYu8IDnCj0c65w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627917003; a=rsa-sha256; cv=none; b=ahyfsVgno7bgPfYXAxJgNLRMn0F9E1qsfNuBsmk8N8iCBq7my0Hxp+wA6RFv0Kt8KDC2MI 1McFwdxcq5udwR6kHkymDZzkMy5NfVFRKO/uQByNCZnN3sCD4u3kYF3lD8FkPgyHdWp17o 88JGGMeobwj6FAk5nlbCae3Yx/AlCt+xioO4JRdYKDEQrFLR2N4PolbimSxJdFwUERBVo8 JJV28ovniiTycUXlCQuMCOuwom2Z2DYs9vsK8gf5zBkGUcsJSrE3bWV6gvAyrUFRVvKbn9 hnwhgdtFxdexvtMg/y6V1xL1XjlA05jXogSggTONdcokdEgA1wnWnod4VSVHcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.53 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: F349C7A1E X-Spam-Score: 0.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: OaDo+QWcJIOf A following commit will use this new function in a public test function. --- test/test-lib.sh | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index 10ee9b72..a8e57e51 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -402,17 +402,8 @@ test_expect_equal () { fi } -# Like test_expect_equal, but takes two filenames. -test_expect_equal_file () { +test_diff_file_ () { local file1 file2 testname basename1 basename2 - exec 1>&6 2>&7 # Restore stdout and stderr - if [ -z "$inside_subtest" ]; then - error "bug in the test script: test_expect_equal_file without test_begin_subtest" - fi - inside_subtest= - test "$#" = 2 || - error "bug in the test script: not 2 parameters to test_expect_equal_file" - file1="$1" file2="$2" if ! test_skip "$test_subtest_name" @@ -430,6 +421,19 @@ test_expect_equal_file () { fi } +# Like test_expect_equal, but takes two filenames. +test_expect_equal_file () { + exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_expect_equal_file without test_begin_subtest" + fi + inside_subtest= + test "$#" = 2 || + error "bug in the test script: not 2 parameters to test_expect_equal_file" + + test_diff_file_ "$1" "$2" +} + # Like test_expect_equal, but arguments are JSON expressions to be # canonicalized before diff'ing. If an argument cannot be parsed, it # is used unchanged so that there's something to diff against. -- 2.30.2