On Tuesday, July 28, 2015, Karthik Nayak <karthik....@gmail.com> wrote:
> Add a new atom "padright" and support %(padright:X) where X is a
> number.  This will align the succeeding atom value to the left
> followed by spaces for a total length of X characters. If X is less
> than the item size, the entire atom value is printed.
>
> Add tests and documentation for the same.
>
> Signed-off-by: Karthik Nayak <karthik....@gmail.com>
> ---
> diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
> index 505a360..19ac480 100755
> --- a/t/t6302-for-each-ref-filter.sh
> +++ b/t/t6302-for-each-ref-filter.sh
> @@ -81,4 +81,20 @@ test_expect_success 'filtering with --contains' '
>         test_cmp expect actual
>  '
>
> +test_expect_success 'padding to the right using `padright`' '
> +       cat >expect <<-\EOF &&
> +       refs/heads/master|refs/heads/master        |refs/heads/master|
> +       refs/heads/side|refs/heads/side          |refs/heads/side|
> +       refs/odd/spot|refs/odd/spot            |refs/odd/spot|
> +       refs/tags/double-tag|refs/tags/double-tag     |refs/tags/double-tag|
> +       refs/tags/four|refs/tags/four           |refs/tags/four|
> +       refs/tags/one|refs/tags/one            |refs/tags/one|
> +       refs/tags/signed-tag|refs/tags/signed-tag     |refs/tags/signed-tag|
> +       refs/tags/three|refs/tags/three          |refs/tags/three|
> +       refs/tags/two|refs/tags/two            |refs/tags/two|
> +       EOF
> +       git for-each-ref 
> --format="%(refname)%(padright:25)|%(refname)|%(refname)|" >actual &&

This fails to test the important case when the atom length is greater
than the padright value (in which case no padding should be done, and
the atom text should extend beyond the 'padright' column).

> +       test_cmp expect actual
> +'
> +
>  test_done
> --
> 2.4.6
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to