mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
add regtest.py
This commit is contained in:
parent
ae4b6c779e
commit
a1af47976a
35
regtest.py
Normal file
35
regtest.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# test whether hledger output matches ledger's
|
||||||
|
|
||||||
|
from os import *
|
||||||
|
from posix import *
|
||||||
|
|
||||||
|
files = [
|
||||||
|
'test.dat',
|
||||||
|
'test1.dat',
|
||||||
|
# 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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user