# HG changeset patch # User Raphaël Gomès # Date 1624451695 -7200 # Node ID e9c5c368be17ccf00dba18abf6f8f00d754e9857 # Parent bc01b8ad61348750028bf1f21651ad72ef62de19 run-tests: also catch double-escapes for $TESTTMP On Windows the `$TESTTMP` string "repr" is different than its value, because `\` become `\\`. We introduce a new `$STR_REPR_TESTTMP` substitution to match that too. Differential Revision: https://phab.mercurial-scm.org/D11001 diff -r bc01b8ad6134 -r e9c5c368be17 tests/run-tests.py --- a/tests/run-tests.py Thu Jul 08 17:13:18 2021 +0200 +++ b/tests/run-tests.py Wed Jun 23 14:34:55 2021 +0200 @@ -1308,6 +1308,11 @@ (br'\bHG_TXNID=TXN:[a-f0-9]{40}\b', br'HG_TXNID=TXN:$ID$'), ] r.append((self._escapepath(self._testtmp), b'$TESTTMP')) + if os.name == 'nt': + # JSON output escapes backslashes in Windows paths, so also catch a + # double-escape. + replaced = self._testtmp.replace(b'\\', br'\\') + r.append((self._escapepath(replaced), b'$STR_REPR_TESTTMP')) replacementfile = os.path.join(self._testdir, b'common-pattern.py') diff -r bc01b8ad6134 -r e9c5c368be17 tests/test-paths.t --- a/tests/test-paths.t Thu Jul 08 17:13:18 2021 +0200 +++ b/tests/test-paths.t Wed Jun 23 14:34:55 2021 +0200 @@ -98,9 +98,15 @@ expand: $TESTTMP/a/$SOMETHING/bar $ hg log -rnull -T '{get(peerurls, "dupe")}\n' $TESTTMP/b#tip +#if windows + $ hg log -rnull -T '{peerurls % "{urls|json}\n"}' + [{"pushurl": "https://example.com/dupe", "url": "$STR_REPR_TESTTMP\\b#tip"}] + [{"url": "$STR_REPR_TESTTMP\\a\\$SOMETHING\\bar"}] +#else $ hg log -rnull -T '{peerurls % "{urls|json}\n"}' [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}] [{"url": "$TESTTMP/a/$SOMETHING/bar"}] +#endif (sub options can be populated by map/dot operation)