[PATCH 2 of 6] run-tests: handle output that starts with "$ "
Yuya Nishihara
yuya at tcha.org
Fri Jan 15 08:47:38 CST 2016
On Tue, 12 Jan 2016 12:38:05 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1452619172 0
> # Tue Jan 12 17:19:32 2016 +0000
> # Node ID a4f6489df893272a532f9d9cf88b12fd0619efc6
> # Parent 13f44adf400886e8d65fcb2bcf5dc5763b250214
> run-tests: handle output that starts with "$ "
>
> This is necessary because some help content happens to start with that pattern,
> and it is legitimate, so, we add an escape sequence for "$ " as "\$ ".
>
> If you need to use this escape sequence in a dynamic (echo > test-test.t << EOF)
> test, remember that you have to escape your backslash because the first one
> will be parsed by the shell, and thus will not be in your file.
>
> For normal users, a single backslash is enough, and running your test with -i
> will generate the proper escaping.
>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -1045,6 +1045,9 @@
> elif l.startswith(b' > '): # continuations
> after.setdefault(prepos, []).append(l)
> script.append(l[4:])
> + elif l.startswith(b' \\$'): # results
> + # Queue up a list of expected results.
> + expected.setdefault(pos, []).append(l[2:])
> elif l.startswith(b' '): # results
> # Queue up a list of expected results.
> expected.setdefault(pos, []).append(l[2:])
This seems fine, but " > ", " >>> ", etc. would have the same issue in
theory. So I came up with an idea, " (literal)" suffix. Haven't tried.
$ ls (literal)
foo.c
$ hg status (literal)
foo.c
More information about the Mercurial-devel
mailing list