Skip to content

Commit

Permalink
test: add testcase for ledger syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Kilerd Chan <[email protected]>
  • Loading branch information
Kilerd committed Oct 18, 2024
1 parent c424339 commit 96bf302
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 0 deletions.
27 changes: 27 additions & 0 deletions integration-tests/comments-between-postings/main.bean
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
; comment here
Assets:BankCard -50 CNY
Expenses:Food

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
; comment here
Expenses:Food
; comment here

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
Expenses:Food
; comment here

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
Expenses:Food
; comment here
; comment here
27 changes: 27 additions & 0 deletions integration-tests/comments-between-postings/main.zhang
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
; comment here
Assets:BankCard -50 CNY
Expenses:Food

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
; comment here
Expenses:Food
; comment here

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
Expenses:Food
; comment here

2023-12-06 "KFC" "VME50 Package"
Assets:BankCard -50 CNY
Expenses:Food
; comment here
; comment here
23 changes: 23 additions & 0 deletions integration-tests/comments-between-postings/validations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"uri": "/api/journals",
"validations": [
[
"$.data.records[0].postings.length()",
2
],
[
"$.data.records[1].postings.length()",
2
],
[
"$.data.records[2].postings.length()",
2
],
[
"$.data.records[3].postings.length()",
2
]
]
}
]
11 changes: 11 additions & 0 deletions integration-tests/inconsitent-indent-for-postings/main.bean
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
Expenses:A -0.0CNY
Expenses:Food
Expenses:Fo
Expenses:A -0.0CNY
11 changes: 11 additions & 0 deletions integration-tests/inconsitent-indent-for-postings/main.zhang
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
Expenses:A -0.0CNY
Expenses:Food
Expenses:Fo
Expenses:A -0.0CNY
11 changes: 11 additions & 0 deletions integration-tests/inconsitent-indent-for-postings/validations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"uri": "/api/journals",
"validations": [
[
"$.data.records[0].postings.length()",
4
]
]
}
]
10 changes: 10 additions & 0 deletions integration-tests/space-of-posting-uint-can-be-empty/main.bean
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
Expenses:A -0.0CNY
Expenses:Food -0.0CNY@1USD
Expenses:Food -0.0CNY@@1USD
10 changes: 10 additions & 0 deletions integration-tests/space-of-posting-uint-can-be-empty/main.zhang
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
option "operating_currency" "CNY"

1970-01-01 open Assets:BankCard CNY

1970-01-01 open Expenses:Food CNY

2023-12-06 "KFC" "VME50 Package"
Expenses:A -0.0CNY
Expenses:Food -0.0CNY@1USD
Expenses:Food -0.0CNY@@1USD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"uri": "/api/journals",
"validations": [
[
"$.data.records[0].postings.length()",
3
]
]
}
]

0 comments on commit 96bf302

Please sign in to comment.