Re: [PATCH 17/19] t: add tests for switch
On Wed, Jan 30, 2019 at 4:50 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 10 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
> @@ -0,0 +1,91 @@
> +test_expect_success 'switch and create branch' '
> + test_when_finished git switch master &&
> + git switch -c temp master^ &&
> + git rev-parse master^ >expected &&
> + git rev-parse refs/heads/temp >actual &&
> + test_cmp expected actual &&
The above three lines could be replaced with test_cmp_rev()?
Show 12 quoted lines
> + echo refs/heads/temp >expected-branch &&
> + git symbolic-ref HEAD >actual-branch &&
> + test_cmp expected-branch actual-branch
> +'
> +
> +test_expect_success 'force create branch from HEAD' '
> + test_when_finished git switch master &&
> + git switch --detach master &&
> + git switch -C temp &&
> + git rev-parse master >expected &&
> + git rev-parse refs/heads/temp >actual &&
> + test_cmp expected actual &&
> + echo refs/heads/temp >expected-branch &&
> + git symbolic-ref HEAD >actual-branch &&
> + test_cmp expected-branch actual-branch
> +'