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

[PATCH 6/6] whitespace: tests for git-apply --whitespace=fix with tab-in-indent

From
Chris Webb <chris@arachsys.com>
Date
Apr 2, 2010, 23:37 UTC
Message-ID
<0efb5aca7f738403283ec97ad53c645d8f7240eb.1270250437.git.chris@arachsys.com>
In-Reply-To
<cover.1270250437.git.chris@arachsys.com>
Signed-off-by: Chris Webb <chris@arachsys.com>
---
 t/t4124-apply-ws-rule.sh |   53 +++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index fb9ad24..8d46df6 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -11,21 +11,22 @@ prepare_test_file () {
 	#   	!  trailing-space
 	#   	@  space-before-tab
 	#   	#  indent-with-non-tab
+	#   	%  tab-in-indent
 	sed -e "s/_/ /g" -e "s/>/	/" <<-\EOF
 		An_SP in an ordinary line>and a HT.
-		>A HT.
-		_>A SP and a HT (@).
-		_>_A SP, a HT and a SP (@).
+		>A HT (%).
+		_>A SP and a HT (@%).
+		_>_A SP, a HT and a SP (@%).
 		_______Seven SP.
 		________Eight SP (#).
-		_______>Seven SP and a HT (@).
-		________>Eight SP and a HT (@#).
-		_______>_Seven SP, a HT and a SP (@).
-		________>_Eight SP, a HT and a SP (@#).
+		_______>Seven SP and a HT (@%).
+		________>Eight SP and a HT (@#%).
+		_______>_Seven SP, a HT and a SP (@%).
+		________>_Eight SP, a HT and a SP (@#%).
 		_______________Fifteen SP (#).
-		_______________>Fifteen SP and a HT (@#).
+		_______________>Fifteen SP and a HT (@#%).
 		________________Sixteen SP (#).
-		________________>Sixteen SP and a HT (@#).
+		________________>Sixteen SP and a HT (@#%).
 		_____a__Five SP, a non WS, two SP.
 		A line with a (!) trailing SP_
 		A line with a (!) trailing HT>
@@ -39,7 +40,6 @@ apply_patch () {
 }
 
 test_fix () {
-
 	# fix should not barf
 	apply_patch --whitespace=fix || return 1
 
@@ -130,20 +130,25 @@ do
 		for i in - ''
 		do
 			case "$i" in '') ti='#' ;; *) ti= ;; esac
-			rule=${t}trailing,${s}space,${i}indent
-
-			rm -f .gitattributes
-			test_expect_success "rule=$rule" '
-				git config core.whitespace "$rule" &&
-				test_fix "$tt$ts$ti"
-			'
-
-			test_expect_success "rule=$rule (attributes)" '
-				git config --unset core.whitespace &&
-				echo "target whitespace=$rule" >.gitattributes &&
-				test_fix "$tt$ts$ti"
-			'
-
+			for h in - ''
+			do
+				[ -z "$h$i" ] && continue
+				case "$h" in '') th='%' ;; *) th= ;; esac
+				rule=${t}trailing,${s}space,${i}indent,${h}tab
+
+				rm -f .gitattributes
+				test_expect_success "rule=$rule" '
+					git config core.whitespace "$rule" &&
+					test_fix "$tt$ts$ti$th"
+				'
+
+				test_expect_success "rule=$rule (attributes)" '
+					git config --unset core.whitespace &&
+					echo "target whitespace=$rule" >.gitattributes &&
+					test_fix "$tt$ts$ti$th"
+				'
+
+			done
 		done
 	done
 done
-- 
1.7.0.3
Previous: Chris Webb
Message 8 of 8 in “Add tab-in-indent whitespace rule”
  1. 0/6 Add tab-in-indent whitespace ruleChris Webb, Apr 2, 2010
  2. 1/6 whitespace: we cannot "catch all errors known to git" anymoreChris Webb, Apr 2, 2010
  3. 2/6 whitespace: add tab-in-indent error classChris Webb, Apr 2, 2010
  4. Martin MaresApr 3, 2010
  5. 3/6 whitespace: tests for git-diff --check with tab-in-indent error classChris Webb, Apr 2, 2010
  6. 4/6 whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dstChris Webb, Apr 2, 2010
  7. 5/6 whitespace: add tab-in-indent support for --whitespace=fixChris Webb, Apr 2, 2010
  8. 6/6 whitespace: tests for git-apply --whitespace=fix with tab-in-indentChris Webb, Apr 2, 2010

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.