Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings

Latest commit

 

History

History
History
49 lines (43 loc) · 1.27 KB

File metadata and controls

49 lines (43 loc) · 1.27 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package ledger
import (
"errors"
"testing"
)
func TestIncludeSimple(t *testing.T) {
trans, err := ParseLedgerFile("testdata/ledgerRoot.dat")
if err != nil {
t.Fatal(err)
}
bals := GetBalances(trans, []string{"Assets"})
if bals[0].Balance.StringRound() != "50" {
t.Fatal(errors.New("should be 50"))
}
}
func TestIncludeGlob(t *testing.T) {
trans, err := ParseLedgerFile("testdata/ledgerRootGlob.dat")
if err != nil {
t.Fatal(err)
}
bals := GetBalances(trans, []string{"Assets"})
if bals[0].Balance.StringRound() != "80" {
t.Fatal(errors.New("should be 80"))
}
}
func TestIncludeUnbalanced(t *testing.T) {
_, err := ParseLedgerFile("testdata/ledgerRootUnbalanced.dat")
if err.Error() != "testdata/ledger-2021-05.dat:12: unable to parse transaction: unable to balance transaction: no empty account to place extra balance" {
t.Fatal(err)
}
}
func TestIncludeNonExistant(t *testing.T) {
_, err := ParseLedgerFile("testdata/ledgerRootNonExist.dat")
if err.Error() != "testdata/ledgerRootNonExist.dat:3: unable to include file(ledger-xxxxx.dat): not found" {
t.Fatal(err)
}
}
func TestNonExistant(t *testing.T) {
_, err := ParseLedgerFile("testdata/ledger-xxxxx.dat")
if err.Error() != "open testdata/ledger-xxxxx.dat: no such file or directory" {
t.Fatal(err)
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.