Re: [PATCH v2] tests: make sure rename pretty print works
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 6, 2013, 22:03 UTC
- Message-ID
- <7v7glkp4n6.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1362605772-14639-1-git-send-email-apelisse@gmail.com>
Antoine Pelisse <apelisse@gmail.com> writes:
Show 14 quoted lines
> Add basic use cases and corner cases tests for > "git diff -M --summary/stat". > > Signed-off-by: Antoine Pelisse <apelisse@gmail.com> > --- > list of fixes: > - Test using diff instead of show > (that is more consistent with commit message). > - add extra spaces around paths > - Use better commit messages > - Moved to existing t4001 > > t/t4001-diff-rename.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 54 insertions(+)
Nice.
Will queue, but we may want to make these tests more independent from each other later. For example, if the first test fails before its "git mv a/b/c c/b/a", the set-up of the second test to further move it to c/d/e will fail, which is probably not very desirable.
Thanks.
Show 57 quoted lines
> +test_expect_success 'rename pretty print with nothing in common' '
> + mkdir -p a/b/ &&
> + : >a/b/c &&
> + git add a/b/c &&
> + git commit -m "create a/b/c" &&
> + mkdir -p c/b/ &&
> + git mv a/b/c c/b/a &&
> + git commit -m "a/b/c -> c/b/a" &&
> + git diff -M --summary HEAD^ HEAD >output &&
> + test_i18ngrep " a/b/c => c/b/a " output &&
> + git diff -M --stat HEAD^ HEAD >output &&
> + test_i18ngrep " a/b/c => c/b/a " output
> +'
> +
> +test_expect_success 'rename pretty print with common prefix' '
> + mkdir -p c/d &&
> + git mv c/b/a c/d/e &&
> + git commit -m "c/b/a -> c/d/e" &&
> + git diff -M --summary HEAD^ HEAD >output &&
> + test_i18ngrep " c/{b/a => d/e} " output &&
> + git diff -M --stat HEAD^ HEAD >output &&
> + test_i18ngrep " c/{b/a => d/e} " output
> +'
> +
> +test_expect_success 'rename pretty print with common suffix' '
> + mkdir d &&
> + git mv c/d/e d/e &&
> + git commit -m "c/d/e -> d/e" &&
> + git diff -M --summary HEAD^ HEAD >output &&
> + test_i18ngrep " {c/d => d}/e " output &&
> + git diff -M --stat HEAD^ HEAD >output &&
> + test_i18ngrep " {c/d => d}/e " output
> +'
> +
> +test_expect_success 'rename pretty print with common prefix and suffix' '
> + mkdir d/f &&
> + git mv d/e d/f/e &&
> + git commit -m "d/e -> d/f/e" &&
> + git diff -M --summary HEAD^ HEAD >output &&
> + test_i18ngrep " d/{ => f}/e " output &&
> + git diff -M --stat HEAD^ HEAD >output &&
> + test_i18ngrep " d/{ => f}/e " output
> +'
> +
> +test_expect_success 'rename pretty print common prefix and suffix overlap' '
> + mkdir d/f/f &&
> + git mv d/f/e d/f/f/e &&
> + git commit -m "d/f/e d/f/f/e" &&
> + git diff -M --summary HEAD^ HEAD >output &&
> + test_i18ngrep " d/f/{ => f}/e " output &&
> + git diff -M --stat HEAD^ HEAD >output &&
> + test_i18ngrep " d/f/{ => f}/e " output
> +'
> +
> test_done
> --
> 1.7.9.5