D12010: tests: also test spaces in conflict marker labels

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 21 23:32:34 UTC 2022


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Our fake merge tool printed the arguments using `$1` etc. without
  quotes, which means that the shell collapsed repeated spaces within
  the argument. That resulted in tests that did not pick up changes to
  the number of spaces.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12010

AFFECTED FILES
  tests/test-merge-tools.t

CHANGE DETAILS

diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -1580,7 +1580,7 @@
   true.executable=cat
   # hg update -C 1
   $ cat <<EOF > printargs_merge_tool
-  > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
+  > while test \$# -gt 0; do echo arg: \""\$1"\"; shift; done
   > EOF
   $ hg --config merge-tools.true.executable='sh' \
   >    --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
@@ -1606,7 +1606,7 @@
   true.executable=cat
   # hg update -C 1
   $ cat <<EOF > printargs_merge_tool
-  > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
+  > while test \$# -gt 0; do echo arg: \""\$1"\"; shift; done
   > EOF
   $ hg --config experimental.mergetempdirprefix=$TESTTMP/hgmerge. \
   >    --config merge-tools.true.executable='sh' \
@@ -1636,7 +1636,7 @@
   true.executable=cat
   # hg update -C 1
   $ cat <<EOF > printargs_merge_tool
-  > while test \$# -gt 0; do echo arg: \"\$1\"; shift; done
+  > while test \$# -gt 0; do echo arg: \""\$1"\"; shift; done
   > EOF
   $ hg --config merge-tools.true.executable='sh' \
   >    --config merge-tools.true.args='./printargs_merge_tool ll:$labellocal lo: $labelother lb:$labelbase": "$base' \
@@ -1648,7 +1648,7 @@
   merging f
   arg: "ll:working copy: tooltmpl ef83787e2614"
   arg: "lo:"
-  arg: "merge rev: tooltmpl 0185f4e0cf02"
+  arg: "merge rev:    tooltmpl 0185f4e0cf02"
   arg: "lb:base: */f~base.*" (glob)
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -1664,9 +1664,9 @@
   true.executable=cat
   # hg update -C 1
   $ cat <<EOF > mytool
-  > echo labellocal: \"\$1\"
-  > echo labelother: \"\$2\"
-  > echo "output (arg)": \"\$3\"
+  > echo labellocal: \""\$1"\"
+  > echo labelother: \""\$2"\"
+  > echo "output (arg)": \""\$3"\"
   > echo "output (contents)":
   > cat "\$3"
   > EOF
@@ -1702,9 +1702,9 @@
   true.executable=cat
   # hg update -C 1
   $ cat <<EOF > mytool
-  > echo labellocal: \"\$1\"
-  > echo labelother: \"\$2\"
-  > echo "output (arg)": \"\$3\"
+  > echo labellocal: \""\$1"\"
+  > echo labelother: \""\$2"\"
+  > echo "output (arg)": \""\$3"\"
   > echo "output (contents)":
   > cat "\$3"
   > EOF
@@ -1718,7 +1718,7 @@
   >    merge -r 2
   merging f
   labellocal: "working copy: tooltmpl ef83787e2614"
-  labelother: "merge rev: tooltmpl 0185f4e0cf02"
+  labelother: "merge rev:    tooltmpl 0185f4e0cf02"
   output (arg): "$TESTTMP/repo/f"
   output (contents):
   <<<<<<< working copy: tooltmpl ef83787e2614



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list