From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sJAyCjZvCmG9/AAAgWs5BA (envelope-from ) for ; Wed, 04 Aug 2021 12:43:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SHzvBTZvCmEdHAAA1q6Kng (envelope-from ) for ; Wed, 04 Aug 2021 10:43:02 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6B208A4D3 for ; Wed, 4 Aug 2021 12:43:01 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 404DC2C0DE; Wed, 4 Aug 2021 06:42:48 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 6295E2C0B0 for ; Wed, 4 Aug 2021 06:42:44 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 5C8785FD5C; Wed, 4 Aug 2021 06:42:44 -0400 (EDT) Received: (nullmailer pid 3986521 invoked by uid 1000); Wed, 04 Aug 2021 10:42:42 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 2/7] test: factor out test_diff_file_ Date: Wed, 4 Aug 2021 07:42:31 -0300 Message-Id: <20210804104236.3986362-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210804104236.3986362-1-david@tethera.net> References: <20210804104236.3986362-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: CJ7FA6IOC6UDLSFYAG4VCV6ZCFOPZMVR X-Message-ID-Hash: CJ7FA6IOC6UDLSFYAG4VCV6ZCFOPZMVR 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=1628073781; 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=im65EY0RmcBuSF7GLxiEhMQQb5VyEilbh3KIHs3nnc8=; b=TiH6Q6xvlEV8y6ANz9Bi6mgqEw2nAZQ+canaWSj+LR8kjc1b6gf3FxhfrJIctt9QToGmx1 nWSseTBcRyW0XMnkzexQZ7YoUEdYOkQCR64rV2VfUQBAfsIXy8vEVJEki5yS0/YjvKMW/5 HdebnsVfEYrAlH9gNGGzRGzVfa4IiAg0fKmzsurfCMLulHiP5fx4qLtiHNUKVhfrcosskK aSgS2O3P9rWSa4KjnQ1zKYGNmQ6xuQvrbQrXpW97vmSgLdAlnwF/IhVrtSX5OcuVMniVNR pPMEyN86GkocI/vw2ZBpk63I7/Cv9IaOowyBr30I7FrKMKB4oaR6en4VdPg+3g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628073781; a=rsa-sha256; cv=none; b=oPsJNbV2atNHUCpo/Z51hR4hkiOpnGVLGqHn7TzC8GW/7WmEP/YD1MjrW9TMz3XX4HQjNI 4kBGKdVzEPxBkRWiW1H35g3u3gcFmgw4Fmgk7w3sksAcOvp/jXgqjJwArs0sOiTstmGLeO bWbMv57949Jr35xfCX3nG73XiWFDLS6K2tnk1EsxGAK4XzJLM5Kz0F5AIJgdqK6bSz8jpK 7fXmSX1CwpNVsU+6m8/2MQZZSB4hQyeoTgHVeObDlYAg23K4E5P9mQAJY1QD8kXpIEFXgo a11sEB4TJP96sYXtt4dfyH/Q1nIRYF0wuxwdsNdx2q1GHaBehS1cx2yRKstTNw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.02 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 6B208A4D3 X-Spam-Score: -1.02 X-Migadu-Scanner: scn1.migadu.com X-TUID: oBECLecskQ/P 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 1f696c44..6f4bb47f 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