Re: [PATCH v2 3/5] t0041: use test_line_count_cmd to check std{out,err}

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

 



Đoàn Trần Công Danh  <congdanhqx@xxxxxxxxx> writes:

>  test_expect_success 'tag --contains <existent_tag>' '
> -	git tag --contains "v1.0" >actual 2>actual.err &&
> -	grep "v1.0" actual &&
> -	test_line_count = 0 actual.err
> +	test_line_count_cmd --err = 0 git tag --contains v1.0 >actual &&
> +	grep "v1.0" actual

Sorry, but I am not impressed if this is a typical/prime example of
how the new helper helps in writing our tests.

Notice that so many tests that you touched only care about 0 lines?

Instead of this new helper, I think it would be a more useful
improvement if we check the emptyness in a more direct way, i.e.

>  test_expect_success 'tag --contains <existent_tag>' '
> 	git tag --contains "v1.0" >actual 2>actual.err &&
> 	grep "v1.0" actual &&
> -	test_line_count = 0 actual.err
> +	test_must_be_empty actual.err

I think this helper may be misnamed and test_file_is_empty would sit
better with test_dir_is_empty and test_file_not_empty that already
exist, though.

By the way, my opinion would be quite different if example like this
one ...

>  test_expect_success 'tag --no-contains <existent_tag>' '
> -	git tag --no-contains "v1.0" >actual 2>actual.err  &&
> -	test_line_count = 0 actual &&
> -	test_line_count = 0 actual.err
> +	test_line_count_cmd --out = 0 --err = 0 git tag --no-contains v1.0
>  '

... were the majority, but I do not think that is the case.  Most
tests that employ the new test_line_count_cmd in this patch still
create either actual or actual.err in the working tree anyway, so I
do not see much point in adding this new helper---it is hard to
explain to new test writers when to use it.




[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]

  Powered by Linux