##// 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:

r40645:ee9981bc default
r44267:19da643d default
Show More
test-custom-filters.t
67 lines | 1.6 KiB | text/troff | Tads3Lexer
/ tests / test-custom-filters.t
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg init
$ cat > .hg/hgrc <<EOF
> [extensions]
> prefixfilter = prefix.py
> [encode]
> *.txt = stripprefix: Copyright 2046, The Masters
> [decode]
> *.txt = insertprefix: Copyright 2046, The Masters
> EOF
$ cat > prefix.py <<EOF
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > from mercurial import error
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > def stripprefix(s, cmd, filename, **kwargs):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > header = b'%s\n' % cmd
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > if s[:len(header)] != header:
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > return s[len(header):]
> def insertprefix(s, cmd):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > return b'%s\n%s' % (cmd, s)
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > def reposetup(ui, repo):
Pulkit Goyal
py3: add b'' prefixes in tests/test-custom-filters.t...
r38082 > repo.adddatafilter(b'stripprefix:', stripprefix)
> repo.adddatafilter(b'insertprefix:', insertprefix)
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > EOF
$ cat > .hgignore <<EOF
> .hgignore
> prefix.py
> prefix.pyc
Pulkit Goyal
py3: add __pycache__ to .hgignore...
r40645 > __pycache__/
Nicolas Dumazet
tests: unify test-custom-filters
r12124 > EOF
$ cat > stuff.txt <<EOF
> Copyright 2046, The Masters
> Some stuff to ponder very carefully.
> EOF
$ hg add stuff.txt
$ hg ci -m stuff
Repository data:
$ hg cat stuff.txt
Some stuff to ponder very carefully.
Fresh checkout:
$ rm stuff.txt
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat stuff.txt
Copyright 2046, The Masters
Some stuff to ponder very carefully.
Nicolas Dumazet
test-custom-filter: heredoc is not required for single line operations
r12125 $ echo "Very very carefully." >> stuff.txt
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg stat
M stuff.txt
Nicolas Dumazet
test-custom-filter: heredoc is not required for single line operations
r12125 $ echo "Unauthorized material subject to destruction." > morestuff.txt
Nicolas Dumazet
tests: unify test-custom-filters
r12124
Problem encoding:
$ hg add morestuff.txt
$ hg ci -m morestuff
abort: missing header "Copyright 2046, The Masters" in morestuff.txt
Matt Mackall
tests: add exit codes to unified tests
r12316 [255]
Nicolas Dumazet
tests: unify test-custom-filters
r12124 $ hg stat
M stuff.txt
A morestuff.txt