[PATCH 2 of 6] run-tests: handle output that starts with "$ "
yuya at tcha.org
Mon Jan 18 08:05:32 CST 2016
On Sun, 17 Jan 2016 10:48:26 -0800, Pierre-Yves David wrote:
> On 01/15/2016 06:47 AM, Yuya Nishihara wrote:
> > 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
> Just to clarify, you mean a "(literal)" flag at the end of any line as
> we do for (glob) and (re) to mark it as an output line.
> The idea seems good to me. I'm not entirely convinced by the name (but
> fine with it).
I don't like "literal", too.
More information about the Mercurial-devel