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 632C06DE00DB for ; Thu, 6 Apr 2017 09:25:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.497 X-Spam-Level: X-Spam-Status: No, score=0.497 tagged_above=-999 required=5 tests=[AWL=-0.155, SPF_NEUTRAL=0.652] 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 YREAo75g3WjT for ; Thu, 6 Apr 2017 09:25:33 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id D01456DE00D2 for ; Thu, 6 Apr 2017 09:25:32 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id B55B3100090; Thu, 6 Apr 2017 19:24:45 +0300 (EEST) From: Tomi Ollila To: David Bremner , David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] test: swap order of arguments of test_expect_equal In-Reply-To: <20170406011250.25153-1-david@tethera.net> References: <20170405003630.15104-2-david@tethera.net> <20170406011250.25153-1-david@tethera.net> User-Agent: Notmuch/0.24+52~g1f96813 (https://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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: Thu, 06 Apr 2017 16:25:34 -0000 On Thu, Apr 06 2017, David Bremner wrote: > For some reason (probably inherited from git), the order arguments for > test_expect_equal was "$output $expected"; this again matters when > generating diffs. > --- IMO these both of these should use expected - output argument order. But more important than that is to get id:20170405003630.15104-1-david@tethera.net merged soon so confusion of output ends and if someone(tm) is doing near-future test changes risk of collisions can be avoided. Tomi > > I'm less sure about this one so I didn't go through and update all of > the tests. The existing use of test_expect_equal is mostly "$output" > "$expected", which is natural enough, except that it's the opposite of > the convention for test_expect_equal_file that I thought was obvious > (I guess the latter motivated by the arguments to diff). > > test/T000-basic.sh | 4 ++-- > test/test-lib.sh | 5 +++-- > test/test.expected-output/test-verbose-no | 4 ++-- > test/test.expected-output/test-verbose-yes | 4 ++-- > 4 files changed, 9 insertions(+), 8 deletions(-) > > diff --git a/test/T000-basic.sh b/test/T000-basic.sh > index 36a7ca4c..0d6a2081 100755 > --- a/test/T000-basic.sh > +++ b/test/T000-basic.sh > @@ -52,7 +52,7 @@ suppress_diff_date() { > test_begin_subtest "Ensure that test output is suppressed unless the test fails" > output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose 2>&1 | suppress_diff_date) > expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date) > -test_expect_equal "$output" "$expected" > +test_expect_equal "$expected" "$output" > > test_begin_subtest "Ensure that -v does not suppress test output" > output=$(cd $TEST_DIRECTORY; NOTMUCH_TEST_QUIET= ./test-verbose -v 2>&1 | suppress_diff_date) > @@ -60,7 +60,7 @@ expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date) > # Do not include the results of test-verbose in totals > rm $TEST_DIRECTORY/test-results/test-verbose > rm -r $TEST_DIRECTORY/tmp.test-verbose > -test_expect_equal "$output" "$expected" > +test_expect_equal "$expected" "$output" > > > ################################################################ > diff --git a/test/test-lib.sh b/test/test-lib.sh > index 988b00af..374f6da5 100644 > --- a/test/test-lib.sh > +++ b/test/test-lib.sh > @@ -566,8 +566,9 @@ test_expect_equal () > test "$#" = 2 || > error "bug in the test script: not 2 parameters to test_expect_equal" > > - output="$1" > - expected="$2" > + expected="$1" > + output="$2" > + > if ! test_skip "$test_subtest_name" > then > if [ "$output" = "$expected" ]; then > diff --git a/test/test.expected-output/test-verbose-no b/test/test.expected-output/test-verbose-no > index 1a2ff619..07004182 100644 > --- a/test/test.expected-output/test-verbose-no > +++ b/test/test.expected-output/test-verbose-no > @@ -14,8 +14,8 @@ hello stderr > --- test-verbose.4.expected 2010-11-14 21:41:12.738189710 +0000 > +++ test-verbose.4.output 2010-11-14 21:41:12.738189710 +0000 > @@ -1 +1 @@ > - -b > - +a > + -a > + +b > hello stdout > hello stderr > > diff --git a/test/test.expected-output/test-verbose-yes b/test/test.expected-output/test-verbose-yes > index d25466e9..639b7fa7 100644 > --- a/test/test.expected-output/test-verbose-yes > +++ b/test/test.expected-output/test-verbose-yes > @@ -20,6 +20,6 @@ hello stderr > --- test-verbose.4.expected 2010-11-14 21:41:06.650023289 +0000 > +++ test-verbose.4.output 2010-11-14 21:41:06.650023289 +0000 > @@ -1 +1 @@ > - -b > - +a > + -a > + +b > > -- > 2.11.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch