diff --git a/tests/test-subrepo-paths.t b/tests/test-subrepo-paths.t
--- a/tests/test-subrepo-paths.t
+++ b/tests/test-subrepo-paths.t
@@ -14,7 +14,7 @@ hg debugsub with no remapping
 hg debugsub with remapping
 
   $ echo '[subpaths]' > .hg/hgrc
-  $ echo 'http://example.net/lib(.*) = C:\libs\\1-lib\' >> .hg/hgrc
+  $ printf 'http://example.net/lib(.*) = C:\\libs\\\\1-lib\\\n' >> .hg/hgrc
 
   $ hg debugsub
   path sub