Added DocTests to verify documentation examples

This commit is contained in:
John Wiegley 2009-11-01 21:18:09 -05:00
parent 6538a2d1b8
commit 46a419a5da
11 changed files with 225 additions and 1 deletions

View file

@ -0,0 +1,22 @@
reg --columns=60 food and code xfer
<<<
2009/10/29 (XFER) Panera Bread
Expenses:Food $4.50
Assets:Checking
2009/10/30 (DEP) Pay day!
Assets:Checking $20.00
Income
2009/10/30 (XFER) Panera Bread
Expenses:Food $4.50
Assets:Checking
2009/10/31 (559385768438A8D7) Panera Bread
Expenses:Food $4.50
Liabilities:Credit Card
>>>1
09-Oct-29 Panera Bread Expenses:Food $4.50 $4.50
09-Oct-30 Panera Bread Expenses:Food $4.50 $9.00
>>>2
=== 0

View file

@ -0,0 +1,24 @@
bal checking --set-reported-account=code
<<<
2009/10/29 (XFER) Panera Bread
Expenses:Food $4.50
Assets:Checking
2009/10/30 (DEP) Pay day!
Assets:Checking $20.00
Income
2009/10/30 (XFER) Panera Bread
Expenses:Food $4.50
Assets:Checking
2009/10/31 (559385768438A8D7) Panera Bread
Expenses:Food $4.50
Liabilities:Credit Card
>>>1
$20.00 DEP
$-9.00 XFER
--------------------
$11.00
>>>2
=== 0

View file

@ -0,0 +1,24 @@
reg --columns=60 food and note eat
<<<
2009/11/01 Panera Bread ; Got something to eat
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Coffee
; Lets see, I ate a whole bunch of stuff, drank some coffee,
; pondered a bagel, then decided against the donut.
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Dining
; :Eating:
; This is another long note, after the metadata.
Expenses:Food $4.50
Assets:Checking
>>>1
09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50
09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00
>>>2
=== 0

View file

@ -0,0 +1,23 @@
reg --columns=60 food and tag eating
<<<
2009/11/01 Panera Bread ; Got something to eat
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Coffee
; Lets see, I ate a whole bunch of stuff, drank some coffee,
; pondered a bagel, then decided against the donut.
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Dining
; :Eating:
; This is another long note, after the metadata.
Expenses:Food $4.50
Assets:Checking
>>>1
09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50
>>>2
=== 0

View file

@ -0,0 +1,23 @@
reg --columns=60 food and tag type=dining
<<<
2009/11/01 Panera Bread ; Got something to eat
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Coffee
; Lets see, I ate a whole bunch of stuff, drank some coffee,
; pondered a bagel, then decided against the donut.
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Dining
; :Eating:
; This is another long note, after the metadata.
Expenses:Food $4.50
Assets:Checking
>>>1
09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50
>>>2
=== 0

View file

@ -0,0 +1,27 @@
bal food and tag type --set-reported-account='"Tags:" + tag("Type")'
<<<
2009/11/01 Panera Bread ; Got something to eat
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Coffee
; Lets see, I ate a whole bunch of stuff, drank some coffee,
; pondered a bagel, then decided against the donut.
Expenses:Food $4.50
Assets:Checking
2009/11/01 Panera Bread
; Type: Dining
; :Eating:
; This is another long note, after the metadata.
Expenses:Food $4.50
Assets:Checking
>>>1
$9.00 Tags
$4.50 Coffee
$4.50 Dining
--------------------
$9.00
>>>2
=== 0

View file

@ -0,0 +1,19 @@
reg --columns=60 food
<<<
2009/10/31 * Panera Bread
Expenses:Food $4.50
Assets
2009/11/01 ! Panera Bread
Expenses:Food $4.50
Assets
2009/11/02 Panera Bread
Expenses:Food $4.50
Assets
>>>1
09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50
09-Nov-01 Panera Bread Expenses:Food $4.50 $9.00
09-Nov-02 Panera Bread Expenses:Food $4.50 $13.50
>>>2
=== 0

View file

@ -0,0 +1,17 @@
reg --columns=60 food --cleared
<<<
2009/10/31 * Panera Bread
Expenses:Food $4.50
Assets
2009/11/01 ! Panera Bread
Expenses:Food $4.50
Assets
2009/11/02 Panera Bread
Expenses:Food $4.50
Assets
>>>1
09-Oct-31 Panera Bread Expenses:Food $4.50 $4.50
>>>2
=== 0

View file

@ -0,0 +1,18 @@
reg --columns=60 food --uncleared
<<<
2009/10/31 * Panera Bread
Expenses:Food $4.50
Assets
2009/11/01 ! Panera Bread
Expenses:Food $4.50
Assets
2009/11/02 Panera Bread
Expenses:Food $4.50
Assets
>>>1
09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50
09-Nov-02 Panera Bread Expenses:Food $4.50 $9.00
>>>2
=== 0

View file

@ -0,0 +1,17 @@
reg --columns=60 food --pending
<<<
2009/10/31 * Panera Bread
Expenses:Food $4.50
Assets
2009/11/01 ! Panera Bread
Expenses:Food $4.50
Assets
2009/11/02 Panera Bread
Expenses:Food $4.50
Assets
>>>1
09-Nov-01 Panera Bread Expenses:Food $4.50 $4.50
>>>2
=== 0

View file

@ -247,7 +247,7 @@ endif
TESTS = TESTS =
if HAVE_PYTHON if HAVE_PYTHON
TESTS += RegressTests BaselineTests ConfirmTests GenerateTests TESTS += RegressTests BaselineTests DocTests ConfirmTests GenerateTests
endif endif
if HAVE_CPPUNIT if HAVE_CPPUNIT
@ -381,6 +381,14 @@ BaselineTests: $(srcdir)/test/RegressTests.py
echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/baseline \"\$$@\"" > $@ echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/baseline \"\$$@\"" > $@
chmod 755 $@ chmod 755 $@
DocTests_SOURCES = test/RegressTests.py
EXTRA_DIST += test/doc
DocTests: $(srcdir)/test/RegressTests.py
echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir)/test/doc \"\$$@\"" > $@
chmod 755 $@
ConfirmTests_SOURCES = test/ConfirmTests.py ConfirmTests_SOURCES = test/ConfirmTests.py
EXTRA_DIST += test/input EXTRA_DIST += test/input
@ -424,10 +432,12 @@ endif
fullcheck: cppunittests fullcheck: cppunittests
@$(top_builddir)/RegressTests --verify @$(top_builddir)/RegressTests --verify
@$(top_builddir)/BaselineTests --verify @$(top_builddir)/BaselineTests --verify
@$(top_builddir)/DocTests --verify
@$(top_builddir)/ConfirmTests --verify @$(top_builddir)/ConfirmTests --verify
@$(top_builddir)/GenerateTests --verify @$(top_builddir)/GenerateTests --verify
@$(top_builddir)/RegressTests --gmalloc @$(top_builddir)/RegressTests --gmalloc
@$(top_builddir)/BaselineTests --gmalloc @$(top_builddir)/BaselineTests --gmalloc
@$(top_builddir)/DocTests --gmalloc
# @$(top_builddir)/ConfirmTests --gmalloc # @$(top_builddir)/ConfirmTests --gmalloc
# @$(top_builddir)/GenerateTests --gmalloc # @$(top_builddir)/GenerateTests --gmalloc