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

[PATCH 1/2] t/t4202-log.sh: Add testcases

From
Arjen Laarhoven <arjen@yaph.org>
Date
Jan 22, 2009, 16:37 UTC
Message-ID
<1232642245-94405-1-git-send-email-arjen@yaph.org>

Add testcases for 'git log --diff-filter=[CM]' (copies and renames). Also add a testcase for 'git log --follow'.

Signed-off-by: Arjen Laarhoven <arjen@yaph.org>
---
 t/t4202-log.sh |   59 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 0ab925c..7b976ee 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -16,27 +16,31 @@ test_expect_success setup '
 	test_tick &&
 	git commit -m second &&
 
-	mkdir a &&
-	echo ni >a/two &&
-	git add a/two &&
+	git mv one ichi &&
 	test_tick &&
 	git commit -m third &&
 
-	echo san >a/three &&
-	git add a/three &&
+	cp ichi ein &&
+	git add ein &&
 	test_tick &&
 	git commit -m fourth &&
 
-	git rm a/three &&
+	mkdir a &&
+	echo ni >a/two &&
+	git add a/two &&
+	test_tick &&
+	git commit -m fifth  &&
+
+	git rm a/two &&
 	test_tick &&
-	git commit -m fifth
+	git commit -m sixth
 
 '
 
 test_expect_success 'diff-filter=A' '
 
 	actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&
-	expect=$(echo fourth ; echo third ; echo initial) &&
+	expect=$(echo fifth ; echo fourth ; echo third ; echo initial) &&
 	test "$actual" = "$expect" || {
 		echo Oops
 		echo "Actual: $actual"
@@ -60,7 +64,43 @@ test_expect_success 'diff-filter=M' '
 test_expect_success 'diff-filter=D' '
 
 	actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
-	expect=$(echo fifth) &&
+	expect=$(echo sixth ; echo third) &&
+	test "$actual" = "$expect" || {
+		echo Oops
+		echo "Actual: $actual"
+		false
+	}
+
+'
+
+test_expect_success 'diff-filter=R' '
+
+	actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
+	expect=$(echo third) &&
+	test "$actual" = "$expect" || {
+		echo Oops
+		echo "Actual: $actual"
+		false
+	}
+
+'
+
+test_expect_success 'diff-filter=C' '
+
+	actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
+	expect=$(echo fourth) &&
+	test "$actual" = "$expect" || {
+		echo Oops
+		echo "Actual: $actual"
+		false
+	}
+
+'
+
+test_expect_success 'git log --follow' '
+
+	actual=$(git log --follow --pretty="format:%s" ichi) &&
+	expect=$(echo third ; echo second ; echo initial) &&
 	test "$actual" = "$expect" || {
 		echo Oops
 		echo "Actual: $actual"
@@ -72,6 +112,7 @@ test_expect_success 'diff-filter=D' '
 test_expect_success 'setup case sensitivity tests' '
 	echo case >one &&
 	test_tick &&
+	git add one
 	git commit -a -m Second
 '
 
-- 
1.6.1.354.gd9e51
Next: Arjen Laarhoven
Message 1 of 3 in “t/t4202-log.sh: Add testcases”
  1. 1/2 t/t4202-log.sh: Add testcasesArjen Laarhoven, Jan 22, 2009
  2. 2/2 git-log: Follow file copies with 'git log --follow -C -C'Arjen Laarhoven, Jan 22, 2009
  3. Junio C HamanoJan 22, 2009

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.