From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 498276DE20CB for ; Sun, 26 Feb 2017 05:43:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.527 X-Spam-Level: X-Spam-Status: No, score=-0.527 tagged_above=-999 required=5 tests=[AWL=0.193, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YvjjUb6oSjiP for ; Sun, 26 Feb 2017 05:43:34 -0800 (PST) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) by arlo.cworth.org (Postfix) with ESMTPS id C76816DE20D5 for ; Sun, 26 Feb 2017 05:43:32 -0800 (PST) Received: by mail-lf0-f49.google.com with SMTP id a6so1232814lfa.0 for ; Sun, 26 Feb 2017 05:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=GBtq10tm737baWyiDAjsLytoVv1HLJeULABZhCnx6lY=; b=cAyzMiY1rtqUJx+vZ2qG9rtG/4PFE8yVQc9m6r4uamYKbugetSOZJiIKcrn1rLb2Fd AUiEpkHWNqSwW95ECJtZUxK8eqCCmusnrHmqK6KPAK7QGBBjWRnxfqJ8r5c2lVYattoO WroQoSh5EtrBD8peGkTpQHnQHzZdr0/K/TLVJv7pehzg16bEUXyjDqVPVkmcjqYi2tyl AKxergqPw+4g3BL1RPLWzKQXiDrYI13qr99MIY6Ldl9uH6sqE1IyXEaKMOXLzWkBPiah 5cAKsrM2oJxUh04b+gaxFwPXrejSgvW38vqtobyVlqlK5y25tb5jxg9cAPzM1NLlAnX+ 438g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=GBtq10tm737baWyiDAjsLytoVv1HLJeULABZhCnx6lY=; b=IJtDhqw8SC2aEgkvu2DoOlHb/Y3YAr48CbP42HhSasTRDt1TELPQtI0Tizs5Z7LH7U J+jK3xsUYJq/hfSjSWP1cYUOMfUXlE8j5vyt8pYTmz9owilM7KPO847/wmQAPjjDF8ht yXHiXqBOLFlQdvO/486547UsK54x1Y8ihJUcV9BgfmohsQf201Bms5YGGr8mP8Lg3mU/ XarB2/whadwqBb9o1oUWXw18QAjZtq6bgNaRS8N7LJJnDlU9QWwTcFjQ5/fIkpki965h KKxMMaT/5qykPd68t1Y/wfxKzFY5wLsuzCrNIoq0AHuWiQu14GtU6M13bBOAommRFZX/ EyUQ== X-Gm-Message-State: AMke39meExSPqaiIQsl63hmVS8V0RHs1lLW+XusiPxA3nWskrtoGU4/hnbe9NqIb/MKz6w== X-Received: by 10.46.71.207 with SMTP id u198mr3019256lja.42.1488116610954; Sun, 26 Feb 2017 05:43:30 -0800 (PST) Received: from localhost (mobile-access-bcee80-14.dhcp.inet.fi. [188.238.128.14]) by smtp.gmail.com with ESMTPSA id u142sm1323099lja.19.2017.02.26.05.43.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 Feb 2017 05:43:30 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 7/9] test: drop the implicit prereq check mechanism from test_expect_* Date: Sun, 26 Feb 2017 15:42:59 +0200 Message-Id: <2f0c300015a1c65db2e2ef7c3204fc75929ae17d.1488116461.git.jani@nikula.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sun, 26 Feb 2017 13:43:35 -0000 The only place where we use the implicit prereq check is T000-basic.sh where we check that it works. It's an added complication that we don't use. Remove it. The test_have_prereq function can still be used for the same effect in subtests that use test_begin_subtest. For now, this will make it impossible to have prereqs in one-line subtests that don't require test_begin_subtest. This will be fixed in follow-up work. --- test/T000-basic.sh | 2 +- test/test-lib.sh | 26 ++++++-------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/test/T000-basic.sh b/test/T000-basic.sh index 0a8d6cdf40fc..78e183361e7d 100755 --- a/test/T000-basic.sh +++ b/test/T000-basic.sh @@ -23,7 +23,7 @@ test_expect_success 'success is reported like this' ' ' test_set_prereq HAVEIT haveit=no -test_expect_success HAVEIT 'test runs if prerequisite is satisfied' ' +test_expect_success 'test runs if prerequisite is satisfied' ' test_have_prereq HAVEIT && haveit=yes ' diff --git a/test/test-lib.sh b/test/test-lib.sh index 056483c47c0a..3a69c399f6eb 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -570,9 +570,8 @@ test_expect_equal () error "bug in the test script: test_expect_equal without test_begin_subtest" fi inside_subtest= - test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || - error "bug in the test script: not 2 or 3 parameters to test_expect_equal" + error "bug in the test script: not 2 parameters to test_expect_equal" output="$1" expected="$2" @@ -597,9 +596,8 @@ test_expect_equal_file () error "bug in the test script: test_expect_equal_file without test_begin_subtest" fi inside_subtest= - test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || - error "bug in the test script: not 2 or 3 parameters to test_expect_equal" + error "bug in the test script: not 2 parameters to test_expect_equal_file" file1="$1" file2="$2" @@ -640,9 +638,8 @@ test_sort_json () { } test_emacs_expect_t () { - test "$#" = 2 && { prereq=$1; shift; } || prereq= test "$#" = 1 || - error "bug in the test script: not 1 or 2 parameters to test_emacs_expect_t" + error "bug in the test script: not 1 parameter to test_emacs_expect_t" if [ -z "$inside_subtest" ]; then error "bug in the test script: test_emacs_expect_t without test_begin_subtest" fi @@ -757,12 +754,8 @@ notmuch_config_sanitize () # End of notmuch helper functions # Use test_set_prereq to tell that a particular prerequisite is available. -# The prerequisite can later be checked for in two ways: # -# - Explicitly using test_have_prereq. -# -# - Implicitly by specifying the prerequisite tag in the calls to -# test_expect_{success,failure,code}. +# The prerequisite can later be checked for by using test_have_prereq. # # The single parameter is the prerequisite tag (a simple word, in all # capital letters by convention). @@ -891,11 +884,6 @@ test_skip () { break esac done - if test -z "$to_skip" && test -n "$prereq" && - ! test_have_prereq "$prereq" - then - to_skip=t - fi case "$to_skip" in t) test_report_skip_ "$@" @@ -929,9 +917,8 @@ test_subtest_known_broken () { } test_expect_success () { - test "$#" = 3 && { prereq=$1; shift; } || prereq= test "$#" = 2 || - error "bug in the test script: not 2 or 3 parameters to test-expect-success" + error "bug in the test script: not 2 parameters to test_expect_success" test_subtest_name="$1" test_reset_state_ if ! test_skip "$@" @@ -950,9 +937,8 @@ test_expect_success () { } test_expect_code () { - test "$#" = 4 && { prereq=$1; shift; } || prereq= test "$#" = 3 || - error "bug in the test script: not 3 or 4 parameters to test-expect-code" + error "bug in the test script: not 3 parameters to test_expect_code" test_subtest_name="$2" test_reset_state_ if ! test_skip "$@" -- 2.11.0