Re: [PATCH 1/2] t/unit-tests: convert trailer test to use clar

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

 



Seyi Kuforiji <kuforiji98@xxxxxxxxx> writes:

> diff --git a/t/unit-tests/u-trailer.c b/t/unit-tests/u-trailer.c
> new file mode 100644
> index 0000000000..3d60ea1603
> --- /dev/null
> +++ b/t/unit-tests/u-trailer.c

It is a bit sad (not your fault) that this is not shown as a
rename+modification patch, as most of the logic seem to be straight
out of the original.

> +void test_trailer__no_newline_start(void)
> +{
> +	struct contents expected_contents[] = { 0 };
> +
> +	t_trailer_iterator("Fixes: x\n"
> +			   "Acked-by: x\n"
> +			   "Reviewed-by: x\n",
> +			   0,
> +			   expected_contents);
> +}
> +
> +void test_trailer__newline_start(void)
> +{
> +	struct contents expected_contents[] = {
> +		{
> +			.raw = "Fixes: x\n",
> +			.key = "Fixes",
> +			.val = "x",
> +		},
> +		{
> +			.raw = "Acked-by: x\n",
> +			.key = "Acked-by",
> +			.val = "x",
> +		},
> +		{
> +			.raw = "Reviewed-by: x\n",
> +			.key = "Reviewed-by",
> +			.val = "x",
> +		},
> +		{
> +			0
> +		},
> +	};
> +
> +	t_trailer_iterator("\n"
> +			   "Fixes: x\n"
> +			   "Acked-by: x\n"
> +			   "Reviewed-by: x\n",
> +			   3,
> +			   expected_contents);
> +}

This is inherited from the original, but the hardcoded "3" feels a
bit brittle.

Would ARRAY_SIZE(expected_contents)-1 always match the expected
number, I wonder?  Even if it is, improving it is totally outside
the scope of this topic.  I am just mentioning this since I will
forget if I don't ;-).




[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