git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 3/3] t9903: add extra tests for bash.showDirtyState

From
Martin Erik Werner <martinerikwerner@gmail.com>
Date
Feb 13, 2013, 20:58 UTC
Message-ID
<1360789100-26285-2-git-send-email-martinerikwerner@gmail.com>
In-Reply-To
<1360789100-26285-1-git-send-email-martinerikwerner@gmail.com>

Add 3 extra tests for the bash.showDirtyState config option, the test now cover all combinations of the shell var being set/unset and the config option being missing/enabled/disabled, given a dirty file.

* Renamed test 'disabled by config' to 'shell variable set with config
  disabled' for consistency
Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
---
 t/t9903-bash-prompt.sh |   38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index dd9ac6a..2101d91 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -360,12 +360,48 @@ test_expect_success 'prompt - dirty status indicator - before root commit' '
 	test_cmp expected "$actual"
 '
 
-test_expect_success 'prompt - dirty status indicator - disabled by config' '
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '
 	printf " (master)" > expected &&
 	echo "dirty" > file &&
 	test_when_finished "git reset --hard" &&
 	test_config bash.showDirtyState false &&
 	(
+		sane_unset GIT_PS1_SHOWDIRTYSTATE &&
+		__git_ps1 > "$actual"
+	) &&
+	test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '
+	printf " (master)" > expected &&
+	echo "dirty" > file &&
+	test_when_finished "git reset --hard" &&
+	test_config bash.showDirtyState true &&
+	(
+		sane_unset GIT_PS1_SHOWDIRTYSTATE &&
+		__git_ps1 > "$actual"
+	) &&
+	test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '
+	printf " (master)" > expected &&
+	echo "dirty" > file &&
+	test_when_finished "git reset --hard" &&
+	test_config bash.showDirtyState false &&
+	(
+		GIT_PS1_SHOWDIRTYSTATE=y &&
+		__git_ps1 > "$actual"
+	) &&
+	test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '
+	printf " (master *)" > expected &&
+	echo "dirty" > file &&
+	test_when_finished "git reset --hard" &&
+	test_config bash.showDirtyState true &&
+	(
 		GIT_PS1_SHOWDIRTYSTATE=y &&
 		__git_ps1 > "$actual"
 	) &&
-- 
1.7.10.4
Previous: Martin Erik WernerNext: Junio C Hamano
Message 19 of 20 in “Add bash.showUntrackedFiles config option”
  1. 0/2 Add bash.showUntrackedFiles config optionMartin Erik Werner, Feb 12, 2013
  2. 1/2 bash completion: add bash.showUntrackedFiles optionMartin Erik Werner, Feb 12, 2013
  3. Junio C HamanoFeb 12, 2013
  4. 2/2 t9903: add test case for bash.showUntrackedFilesMartin Erik Werner, Feb 12, 2013
  5. Junio C HamanoFeb 12, 2013
  6. 0/3 Add bash.showUntrackedFiles config optionMartin Erik Werner, Feb 13, 2013
  7. 1/3 shell prompt: add bash.showUntrackedFiles optionMartin Erik Werner, Feb 13, 2013
  8. 2/3 t9903: add tests for bash.showUntrackedFilesMartin Erik Werner, Feb 13, 2013
  9. Junio C HamanoFeb 13, 2013
  10. Martin Erik WernerFeb 13, 2013
  11. Junio C HamanoFeb 13, 2013
  12. 3/3 t9903: add extra tests for bash.showDirtyStateMartin Erik Werner, Feb 13, 2013
  13. Junio C HamanoFeb 13, 2013
  14. Martin Erik WernerFeb 13, 2013
  15. Junio C HamanoFeb 13, 2013
  16. Martin Erik WernerFeb 13, 2013
  17. Junio C HamanoFeb 13, 2013
  18. 2/3 t9903: add tests for bash.showUntrackedFilesMartin Erik Werner, Feb 13, 2013
  19. 3/3 t9903: add extra tests for bash.showDirtyStateMartin Erik Werner, Feb 13, 2013
  20. Junio C HamanoFeb 13, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.