[PATCH RFC] tests: require regexes in unified tests to be marked with " (re)"

Matt Mackall mpm at selenic.com
Tue Sep 21 17:18:59 CDT 2010


On Tue, 2010-09-21 at 23:52 +0200, Adrian Buehlmann wrote:
> On 21.09.2010 20:36, Brodie Rao wrote:
> > # HG changeset patch
> > # User Brodie Rao <brodie at bitheap.org>
> > # Date 1285094123 18000
> > # Node ID 2ba3c74f410285bb2da18f6f5fa6ea3b863b8c94
> > # Parent  dbca8f134f00fb10f7154b2f6cd9b8188095b1de
> > tests: require regexes in unified tests to be marked with " (re)"
> > 
> > Consider this test:
> > 
> >   $ hg glog --template '{rev}:{node|short} "{desc}"\n'
> >   @  2:20c4f79fd7ac "3"
> >   |
> >   | o  1:38f24201dcab "2"
> >   |/
> >   o  0:2a18120dc1c9 "1"
> > 
> > Because each line beginning with "|" can be compiled as a regular
> > expression (equivalent to ".*|"), they will match any output.
> > 
> > By requiring regular expressions to be marked with " (re)", we reduce
> > the potential for false negatives.
> > 
> > To match a line ending in " (re)", the line can be suffixed with "
> > (re) (plain)". " (plain)" has no effect anywhere else.
> 
> I don't really like that. You justify this (re) syntax with an example
> (graphlog output) that won't work anymore if combined with regular
> expressions (unless you put a \ before every glog |).
> 
> Can't we just solve the graphlog | problem instead?
> 
> The only problematic character is '|' and near as I can tell it hasn't
> been used anywhere in it's regex meaning in the tests so far.

I'm afraid that just changed a couple minutes ago when I nuked a bunch
of seds.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list