Re: [PATCH v5 04/34] directory rename detection: basic testcases

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

 



> ---
>  t/t6043-merge-rename-directories.sh | 430 ++++++++++++++++++++++++++++++++++++

Many of the new tests added in this patch series perform a lot of checks
running 'test', which has the drawback to fail quietly, leaving us no
clue about which one of the several conditions failed and why.  We have
several test helper functions that check the same but provide a useful
error message if the condition were to fail.
Here are a couple of suggestions in one of the tests, but they are
applicable to many other tests in this patch series.

> +test_expect_failure '1d-check: Directory renames cause a rename/rename(2to1) conflict' '
> +	(
> +		cd 1d &&
> +
> +		git checkout A^0 &&
> +
> +		test_must_fail git merge -s recursive B^0 >out &&
> +		test_i18ngrep "CONFLICT (rename/rename)" out &&
> +
> +		test 8 -eq $(git ls-files -s | wc -l) &&
> +		test 2 -eq $(git ls-files -u | wc -l) &&
> +		test 3 -eq $(git ls-files -o | wc -l) &&

  git ls-files -s >out &&
  test_line_count = 8 out &&
  git ls-files -u >out &&
  test_line_count = 2 out &&
  git ls-files -o >out &&
  test_line_count = 3 out &&

> +
> +		git rev-parse >actual \
> +			:0:x/b :0:x/c :0:x/d :0:x/e :0:x/m :0:x/n &&
> +		git rev-parse >expect \
> +			O:z/b O:z/c O:y/d O:y/e A:y/m B:z/n &&
> +		test_cmp expect actual &&
> +
> +		test_must_fail git rev-parse :0:x/wham &&
> +		git rev-parse >actual \
> +			:2:x/wham :3:x/wham &&
> +		git rev-parse >expect \
> +			A:y/wham B:z/wham &&
> +		test_cmp expect actual &&
> +
> +		test ! -f x/wham &&

This one checks that the given path is not a file, therefore it would
succeed if that path were a directory or a FIFO or whatnot.  I believe
you want to check that the path doesn't exist:

  test_path_is_missing x/wham &&

> +		test -f x/wham~HEAD &&
> +		test -f x/wham~B^0 &&

  test_path_is_file x/wham~HEAD &&
  test_path_is_file x/wham~B^0 &&


> +
> +		git hash-object >actual \
> +			x/wham~HEAD x/wham~B^0 &&
> +		git rev-parse >expect \
> +			A:y/wham B:z/wham &&
> +		test_cmp expect actual
> +	)
> +'



[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