git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 3/4] t7800: modernize tests

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2013, 07:05 UTC
Message-ID
<7vip5nzcqf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1361338528-17835-3-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 32 quoted lines
> Eliminate a lot of redundant work by using test_config().
> Catch more return codes by more use of temporary files
> and test_cmp.
>
> The original tests relied upon restore_test_defaults()
> from the previous test to provide the next test with a sane
> environment.  Make the tests do their own setup so that they
> are not dependent on the success of the previous test.
> The end result is shorter tests and better test isolation.
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> We no longer export variables into the environment per Jonathan's
> suggestion.  This covers all of the review notes.
>
>  t/t7800-difftool.sh | 360 ++++++++++++++++++++++++----------------------------
>  1 file changed, 165 insertions(+), 195 deletions(-)
>
> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
> index 5b5939b..b577c01 100755
> --- a/t/t7800-difftool.sh
> +++ b/t/t7800-difftool.sh
> @@ -10,29 +10,11 @@ Testing basic diff tool invocation
>  
>  . ./test-lib.sh
>  
> +difftool_test_setup()
>  {
> +	test_config diff.tool test-tool &&
> +	test_config difftool.test-tool.cmd 'cat $LOCAL' &&
> +	test_config difftool.bogus-tool.cmd false
>  }
Cute.

Are we sure that $LOCAL is free of $IFS, or is it safer to say 'cat "$LOCAL"' or something?

Show 16 quoted lines
> @@ -324,26 +294,26 @@ test_expect_success PERL 'setup with 2 files different' '
>  '
>  
>  test_expect_success PERL 'say no to the first file' '
> -	diff=$( (echo n; echo) | git difftool -x cat branch ) &&
> -
> -	echo "$diff" | stdin_contains m2 &&
> -	echo "$diff" | stdin_contains br2 &&
> -	echo "$diff" | stdin_doesnot_contain master &&
> -	echo "$diff" | stdin_doesnot_contain branch
> +	(echo n && echo) >input &&
> +	git difftool -x cat branch <input >output &&
> +	cat output | stdin_contains m2 &&
> +	cat output | stdin_contains br2 &&
> +	cat output | stdin_doesnot_contain master &&
> +	cat output | stdin_doesnot_contain branch
Do you need these pipes?  In other words, wouldn't
	stdin_contains whatever <output
be more straight-forward way to say these?
Previous: David Aguilar
Message 5 of 5 in “difftool: silence uninitialized variable warning”
  1. 1/4 difftool: silence uninitialized variable warningDavid Aguilar, Feb 20, 2013
  2. 2/4 t7800: update copyright noticeDavid Aguilar, Feb 20, 2013
  3. 3/4 t7800: modernize testsDavid Aguilar, Feb 20, 2013
  4. 4/4 t7800: "defaults" is no longer a builtin tool nameDavid Aguilar, Feb 20, 2013
  5. Junio C HamanoFeb 20, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.