Mercurial > hg
view tests/heredoctest.py @ 15281:aeeb2afcdc25 stable
check-code: support multiline matches like try/except/finally
- match one pattern at a time against entire file
- find line containing match
- sort matches by line number
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 16 Oct 2011 20:26:20 -0500 |
parents | 3cd1605e9d8e |
children | 474279be5add |
line wrap: on
line source
import doctest, tempfile, os, sys if __name__ == "__main__": fd, name = tempfile.mkstemp(suffix='hg-tst') try: os.write(fd, sys.stdin.read()) os.close(fd) failures, _ = doctest.testfile(name, module_relative=False) if failures: sys.exit(1) finally: os.remove(name)