hledger/tools/regressiontest.py

37 lines
701 B
Python
Raw Normal View History

2007-08-04 18:32:57 +04:00
#!/usr/bin/python
# test whether hledger output matches ledger's
2008-05-27 01:19:21 +04:00
# Simon Michael 2007
2007-08-04 18:32:57 +04:00
from os import *
from posix import *
files = [
2008-05-27 01:19:21 +04:00
'data/test.dat',
'data/test1.dat',
2007-08-04 18:32:57 +04:00
# getenv('LEDGER'),
]
commands = [
'balance petty',
'-s balance',
'-s balance cash',
'register',
'register cash',
'print',
]
do = system
rule = lambda s: "="*30 + s + "="*30
def regtest(file, cmd):
"""Print a heading and the diff of ledger and hledger output. No diff
output is good."""
print rule('%s:%s' % (file,cmd))
putenv('LEDGER',file)
do('ledger %s >1; ./hledger.hs %s >2; diff 1 2' % (cmd,cmd))
for f in files:
for c in commands:
regtest(f,c)