tests: also test spaces in conflict marker labels
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 20 Jan 2022 23:07:35 -0800
changeset 48575 c852950f0e72
parent 48574 abbecb5cd6f3
child 48576 1a84758b4fca
tests: also test spaces in conflict marker labels 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. Differential Revision: https://phab.mercurial-scm.org/D12010
tests/test-merge-tools.t
--- a/tests/test-merge-tools.t	Mon Jan 17 21:20:46 2022 -0500
+++ b/tests/test-merge-tools.t	Thu Jan 20 23:07:35 2022 -0800
@@ -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