[PATCH 3 of 4] match: enable 'relinclude:' syntax
mpm at selenic.com
Fri May 22 09:55:48 CDT 2015
On Thu, 2015-05-21 at 19:53 -0700, Durham Goode wrote:
> >> +def _expandsubinclude(kindpats, root):
> >> + '''Returns the list of subinclude matchers and the kindpats without the
> >> + subincludes in it.'''
> > Insofar as this is a "pure" function with no side effects, it'd actually
> > be better/faster/more convenient to do most of our poking at it with a
> > doctest rather than .t tests.
> I attempted to do this. This _expandsubinclude() requires having files
> exist on disk though, and I couldn't get any combination of
> os.mkdir("$TESTTMP/dir") or open("$TESTTMP/dir/foo") to work from inside
> a doc test.
A pure function is one that has no inputs/outputs/effects aside from its
arguments and return value. Great examples are anything that does
straight string parsing. Doctesting these is great because you can get
directly at all the corner cases quickly and compactly, and it serves as
documentation. This function looked like mostly path manipulation, so a
But if it requires a file on disk... then it's not a pure function, and
it's not a good fit for doctesting. I guess I wasn't spotting that the
recursive call to match was implicitly reading a file.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel