Re: [PATCH 4/4] git-prompt.sh: add tests for submodule indicator
On Mon, Jan 30, 2017 at 9:44 PM, Benjamin Fuchs <email@benjaminfuchs.de> wrote:
Show 15 quoted lines
> Signed-off-by: Benjamin Fuchs <email@benjaminfuchs.de>
> ---
> t/t9903-bash-prompt.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 97c9b32..4dce366 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -37,6 +37,11 @@ test_expect_success 'setup for prompt tests' '
> git commit -m "yet another b2" file &&
> mkdir ignored_dir &&
> echo "ignored_dir/" >>.gitignore &&
> + git checkout -b submodule &&
> + git submodule add ./. sub &&
Show 23 quoted lines
> + git -C sub checkout master &&
> + git add sub &&
> + git commit -m submodule &&
> git checkout master
> '
>
> @@ -755,4 +760,42 @@ test_expect_success 'prompt - hide if pwd ignored - inside gitdir (stderr)' '
> test_cmp expected "$actual"
> '
>
> +test_expect_success 'prompt - submodule indicator' '
> + printf " (sub:master)" >expected &&
> + git checkout submodule &&
> + test_when_finished "git checkout master" &&
> + (
> + cd sub &&
> + GIT_PS1_SHOWSUBMODULE=1 &&
> + __git_ps1 >"$actual"
> + ) &&
> + test_cmp expected "$actual"
> +'
> +
> +test_expect_success 'prompt - submodule indicator - verify false' '
I was puzzled by the "verify false" here. You mean "disabled", right?
Show 29 quoted lines
> + printf " (master)" >expected &&
> + git checkout submodule &&
> + test_when_finished "git checkout master" &&
> + (
> + cd sub &&
> + GIT_PS1_SHOWSUBMODULE= &&
> + __git_ps1 >"$actual"
> + ) &&
> + test_cmp expected "$actual"
> +'
> +
> +test_expect_success 'prompt - submodule indicator - dirty status indicator' '
> + printf " (+sub:b1)" >expected &&
> + git checkout submodule &&
> + git -C sub checkout b1 &&
> + test_when_finished "git checkout master" &&
> + (
> + cd sub &&
> + GIT_PS1_SHOWSUBMODULE=1 &&
> + __git_ps1 >"$actual"
> + ) &&
> + test_cmp expected "$actual"
> +'
> +
> +
> test_done
> --
> 2.7.4
>