changeset 35416:417fa23017f9

tests: avoid echo with backslash escapes Some shells' echo (e.g. Bash's) do not interpret backslash escapes by default, while others shells' do (e.g. Dash's). This led to a failure in test-run-tests.t. We could switch to the more compatible printf, but using a heredoc seems simpler, so that's what this patch does. For anyone who wants to test this for themselves, remove the "unset HGTEST_SHELL" line in helper-runtests.sh and pass e.g. "--shell=/bin/dash" to the test runner. Differential Revision: https://phab.mercurial-scm.org/D1699
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 14 Dec 2017 22:30:03 -0800
parents 56854848e485
children 2105bdd9462a
files tests/test-run-tests.t
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-run-tests.t	Fri Dec 15 12:15:58 2017 +0800
+++ b/tests/test-run-tests.t	Thu Dec 14 22:30:03 2017 -0800
@@ -703,12 +703,14 @@
 
 Accept the fix
 
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP\\foo.hg" >> test-failure.t
-  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
-  $ echo "  saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
+  $ cat >> test-failure.t <<EOF
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to \$TESTTMP/foo.hg
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to $TESTTMP\\foo.hg
+  >   $ echo 'saved backup bundle to \$TESTTMP/foo.hg'
+  >   saved backup bundle to \$TESTTMP/*.hg (glob)
+  > EOF
   $ echo 'y' | rt -i 2>&1
   
   --- $TESTTMP/test-failure.t