Re: [PATCH v3 11/16] t: add tests for restore
On Thu, Apr 25, 2019 at 04:45:55PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 5 quoted lines
> diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh
> new file mode 100755
> index 0000000000..73ea13ede9
> --- /dev/null
> +++ b/t/t2070-restore.sh
Show 24 quoted lines
> +test_expect_success 'restore --ignore-unmerged ignores unmerged entries' '
> + git init unmerged &&
> + (
> + cd unmerged &&
> + echo one >unmerged &&
> + echo one >common &&
> + git add unmerged common &&
> + git commit -m common &&
> + git switch -c first &&
> + echo first >unmerged &&
> + git commit -am first &&
> + git switch -c second master &&
> + echo second >unmerged &&
> + git commit -am second &&
> + test_must_fail git merge first &&
> +
> + echo dirty >>common &&
> + test_must_fail git restore . &&
> +
> + git restore --ignore-unmerged --quiet . >output 2>&1 &&
> + git diff common >diff-output &&
> + : >empty &&
> + test_cmp empty output &&
> + test_cmp empty diff-output
Please use 'test_must_be_empty'.
(and perhaps 'git diff --exit-code common'? dunno)