##// END OF EJS Templates
tests: finally fix up test-fuzz-targets.t...
tests: finally fix up test-fuzz-targets.t It's been failing on my workstation for a while, since I have a new enough LLVM that I had the fuzzer goo, but not so new that I actually had FuzzedDataProvider. This is a better solution all around in my opinion. I _believe_ this should let us run these tests on most systems, even those using GCC instead of clang. That said, my one attempt to test this on my macOS laptop failed miserably, and I don't feel like doing more work on this right now. Differential Revision: https://phab.mercurial-scm.org/D7566

File last commit:

r43346:2372284d default
r44267:19da643d default
Show More
test-minifileset.py
43 lines | 1.3 KiB | text/x-python | PythonLexer
/ tests / test-minifileset.py
Matt Harbison
fileset: add a lightweight file filtering language...
r35634 from __future__ import absolute_import
from __future__ import print_function
from mercurial import minifileset
Augie Fackler
formatting: blacken the codebase...
r43346
Matt Harbison
fileset: add a lightweight file filtering language...
r35634 def check(text, truecases, falsecases):
f = minifileset.compile(text)
for args in truecases:
if not f(*args):
print('unexpected: %r should include %r' % (text, args))
for args in falsecases:
if f(*args):
print('unexpected: %r should exclude %r' % (text, args))
Augie Fackler
formatting: blacken the codebase...
r43346
Augie Fackler
tests: port test-minifileset.py to Python 3...
r37894 check(b'all()', [(b'a.php', 123), (b'b.txt', 0)], [])
check(b'none()', [], [(b'a.php', 123), (b'b.txt', 0)])
check(b'!!!!((!(!!all())))', [], [(b'a.php', 123), (b'b.txt', 0)])
Matt Harbison
fileset: add a lightweight file filtering language...
r35634
Augie Fackler
formatting: blacken the codebase...
r43346 check(
b'"path:a" & (**.b | **.c)', [(b'a/b.b', 0), (b'a/c.c', 0)], [(b'b/c.c', 0)]
)
check(
b'(path:a & **.b) | **.c', [(b'a/b.b', 0), (b'a/c.c', 0), (b'b/c.c', 0)], []
)
Matt Harbison
fileset: add a lightweight file filtering language...
r35634
Augie Fackler
formatting: blacken the codebase...
r43346 check(
b'**.bin - size("<20B")', [(b'b.bin', 21)], [(b'a.bin', 11), (b'b.txt', 21)]
)
Matt Harbison
fileset: add a lightweight file filtering language...
r35634
Augie Fackler
formatting: blacken the codebase...
r43346 check(
b'!!**.bin or size(">20B") + "path:bin" or !size(">10")',
[(b'a.bin', 11), (b'b.txt', 21), (b'bin/abc', 11)],
[(b'a.notbin', 11), (b'b.txt', 11), (b'bin2/abc', 11)],
)
Matt Harbison
fileset: add a lightweight file filtering language...
r35634
Augie Fackler
tests: port test-minifileset.py to Python 3...
r37894 check(
b'(**.php and size(">10KB")) | **.zip | ("path:bin" & !"path:bin/README") '
b' | size(">1M")',
[(b'a.php', 15000), (b'a.zip', 0), (b'bin/a', 0), (b'bin/README', 1e7)],
Augie Fackler
formatting: blacken the codebase...
r43346 [(b'a.php', 5000), (b'b.zip2', 0), (b't/bin/a', 0), (b'bin/README', 1)],
)