[PATCH 2 of 6] run-tests: handle output that starts with "$ "
timeless at gmail.com
Fri Jan 15 11:30:00 CST 2016
As long as the .err generator automatically produces it, I'm fine with it.
Actually I'd love for there to be a mode for a command where it outputs at
the beginning whether the output will include file paths, that'd enable us
to recognize that /'s in output should be expected to change direction and
thus the err generator should produce (glob) or whatever we're using to
handle backslash/slash differences.
On Jan 15, 2016 9:59 AM, "Yuya Nishihara" <yuya at tcha.org> 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
> > 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
> > 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)
> $ hg status (literal)
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mercurial-devel