From: Ævar Arnfjörð Bjarmason Date: Tue, 09 Nov 2010 23:09:41 GMT Subject: Re: [RFC/PATCH 02/10] test-lib: introduce test_line_count to measure files Message-ID: In-Reply-To: <20101031073350.GC11483@burratino> On Sun, Oct 31, 2010 at 08:33, Jonathan Nieder wrote: > Some tests check their output with code like the following: > >        test "$(git ls-files -u B | wc -l)" -eq 3 || { >                echo "BAD: should have left stages for B" >                return 1 >        } > > The verbose failure condition is used because test, unlike > diff, does not print any useful information about the > nature of the failure when it fails. > > Introduce a test_line_count function to help. If used like > >        git ls-files -u B >output && >        test_line_count -eq 3 output In an earlier thread I suggested an interface like: test_line_count 3 "git ls-files -u B" But I like yours much better. Ack.