Re: [PATCH 1/3] t7005: use modern test style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ben

Thanks for cleaning up these tests

On 10/08/2025 17:03, D. Ben Knoble wrote:

  TERM=dumb
  export TERM
  test_expect_success 'dumb should error out when falling back on vi' '
-
  	if git commit --amend

Instead of this "if" we should be using test_must_fail here

  	then
  		echo "Oops?"
@@ -56,13 +51,13 @@
  '
test_expect_success 'dumb should prefer EDITOR to VISUAL' '
-
  	EDITOR=./e-EDITOR.sh &&
  	VISUAL=./e-VISUAL.sh &&
  	export EDITOR VISUAL &&
  	git commit --amend &&
-	test "$(git show -s --format=%s)" = "Edited by EDITOR"
-
+	echo "Edited by EDITOR" >expect &&
+	git show -s --format=%s >actual &&
+	test_cmp expect actual

This is a faithful conversion of the original but I'd be tempted to use test_commit_message instead as I think we really should be checking the whole message rather than just the subject line in all these tests.

	test_commit_message HEAD -m "Edited by EDITOR"

The whitespace cleanups all look good to me

Thanks

Phillip

  '
TERM=vt100
@@ -83,8 +78,8 @@
  	esac
  	test_expect_success "Using $i" '
  		git --exec-path=. commit --amend &&
-		git show -s --pretty=oneline |
-		sed -e "s/^[0-9a-f]* //" >actual &&
+		git show -s --pretty=oneline >show &&
+		<show sed -e "s/^[0-9a-f]* //" >actual &&
  		test_cmp expect actual
  	'
  done
@@ -105,8 +100,8 @@
  	esac
  	test_expect_success "Using $i (override)" '
  		git --exec-path=. commit --amend &&
-		git show -s --pretty=oneline |
-		sed -e "s/^[0-9a-f]* //" >actual &&
+		git show -s --pretty=oneline >show &&
+		<show sed -e "s/^[0-9a-f]* //" >actual &&
  		test_cmp expect actual
  	'
  done
@@ -115,17 +110,18 @@
  	echo "echo space >\"\$1\"" >"e space.sh" &&
  	chmod a+x "e space.sh" &&
  	GIT_EDITOR="./e\ space.sh" git commit --amend &&
-	test space = "$(git show -s --pretty=format:%s)"
-
+	echo space >expect &&
+	git show -s --pretty=tformat:%s >actual &&
+	test_cmp expect actual
  '
unset GIT_EDITOR
  test_expect_success 'core.editor with a space' '
-
  	git config core.editor \"./e\ space.sh\" &&
  	git commit --amend &&
-	test space = "$(git show -s --pretty=format:%s)"
-
+	echo space >expect &&
+	git show -s --pretty=tformat:%s >actual &&
+	test_cmp expect actual
  '
test_done





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux