[PATCH 2/2] t9903: add test case for bash.showUntrackedFiles

2013-02-12 Thread Martin Erik Werner
Add a test case for the bash.showUntrackedFiles config option, which
checks that the config option can disable the global effect of the
GIT_PS1_SHOWUNTRACKEDFILES environmant variable.

Signed-off-by: Martin Erik Werner martinerikwer...@gmail.com
---
 t/t9903-bash-prompt.sh |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index f17c1f8..c9417b9 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status 
indicator - not shown insid
test_cmp expected $actual
 '
 
+test_expect_success 'prompt - untracked files status indicator - disabled by 
config' '
+   printf  (master)  expected 
+   echo untracked  file_untracked 
+   test_config bash.showUntrackedFiles false 
+   (
+   GIT_PS1_SHOWUNTRACKEDFILES=y 
+   __git_ps1  $actual
+   ) 
+   test_cmp expected $actual
+'
+
 test_expect_success 'prompt - format string starting with dash' '
printf -- -master  expected 
__git_ps1 -%s  $actual 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] t9903: add test case for bash.showUntrackedFiles

2013-02-12 Thread Junio C Hamano
Martin Erik Werner martinerikwer...@gmail.com writes:

 Add a test case for the bash.showUntrackedFiles config option, which
 checks that the config option can disable the global effect of the
 GIT_PS1_SHOWUNTRACKEDFILES environmant variable.

 Signed-off-by: Martin Erik Werner martinerikwer...@gmail.com
 ---
  t/t9903-bash-prompt.sh |   11 +++
  1 file changed, 11 insertions(+)

 diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
 index f17c1f8..c9417b9 100755
 --- a/t/t9903-bash-prompt.sh
 +++ b/t/t9903-bash-prompt.sh
 @@ -447,6 +447,17 @@ test_expect_success 'prompt - untracked files status 
 indicator - not shown insid
   test_cmp expected $actual
  '
  
 +test_expect_success 'prompt - untracked files status indicator - disabled by 
 config' '
 + printf  (master)  expected 
 + echo untracked  file_untracked 
 + test_config bash.showUntrackedFiles false 
 + (
 + GIT_PS1_SHOWUNTRACKEDFILES=y 
 + __git_ps1  $actual
 + ) 
 + test_cmp expected $actual
 +'

All six combinations need checking:

 * not having the configuration at all and not having the shell
   variable should not show the untracked indicator (already tested).

 * not having the configuration at all and having the shell variable
   should show the untracked indicator (already tested).

 * setting configuration to true without having the shell variable
   should not show the untracked indicator.

 * setting configuration to true and having the shell variable
   should show the unttracked indicator.

 * setting configuration to false and having the shell variable
   should not show the untracked indicator (the above test checks
   this).

 * setting configuration to false without having the shell variable
   should not show the untracked indicator.

to prevent others from breaking the code you wrote for [PATCH 1/2],
so you need three more tests, I guess?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html