Re: [RFC/PATCH 02/10] test-lib: introduce test_line_count to measure files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 31, 2010 at 08:33, Jonathan Nieder <jrnieder@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]