TESTS PASS WOO
parent
c2376afafd
commit
3ea29abf8b
|
|
@ -196,7 +196,7 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
|
||||||
if b, err := readOne(r); err != nil {
|
if b, err := readOne(r); err != nil {
|
||||||
return r, transactionRecipient{}, err
|
return r, transactionRecipient{}, err
|
||||||
} else if !isSpaceByte(b) {
|
} else if !isSpaceByte(b) {
|
||||||
return r, transactionRecipient{}, fmt.Errorf("didnt find leading whitespace for transaction recipient")
|
return io.MultiReader(bytes.NewReader([]byte{b}), r), transactionRecipient{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r, err := readTransactionLeadingWhitespace(r)
|
r, err := readTransactionLeadingWhitespace(r)
|
||||||
|
|
@ -216,12 +216,15 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
|
||||||
result.name += string([]byte{b})
|
result.name += string([]byte{b})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
r = io.MultiReader(bytes.NewReader([]byte{b}), r)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if result.name == "" {
|
if result.name == "" {
|
||||||
return nil, result, fmt.Errorf("did not parse any name for transaction recipient")
|
return nil, result, fmt.Errorf("did not parse any name for transaction recipient")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read "NAME:NAME", now "(\s+|\n).*"
|
||||||
|
|
||||||
for {
|
for {
|
||||||
b, err := readOne(r)
|
b, err := readOne(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -234,6 +237,8 @@ func readTransactionRecipient(r io.Reader) (io.Reader, transactionRecipient, err
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read "\s+", now "(\n|\$1.00)"
|
||||||
|
|
||||||
if b, err := readOne(r); err != nil {
|
if b, err := readOne(r); err != nil {
|
||||||
return r, result, err
|
return r, result, err
|
||||||
} else if isSpaceByte(b) {
|
} else if isSpaceByte(b) {
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ func TestFileDeltas(t *testing.T) {
|
||||||
Account: "AssetAccount:Cash:Fidelity76",
|
Account: "AssetAccount:Cash:Fidelity76",
|
||||||
Value: -1.00,
|
Value: -1.00,
|
||||||
Currency: USD,
|
Currency: USD,
|
||||||
Description: "Power Bill TG2PJ-2PLP5",
|
Description: "Test pay chase TG32S-BT2FF",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Date: "2022-12-12",
|
Date: "2022-12-12",
|
||||||
Account: "Debts:Credit:ChaseFreedomUltdVisa",
|
Account: "Debts:Credit:ChaseFreedomUltdVisa",
|
||||||
Value: 1.00,
|
Value: 1.00,
|
||||||
Currency: USD,
|
Currency: USD,
|
||||||
Description: "Power Bill TG2PJ-2PLP5",
|
Description: "Test pay chase TG32S-BT2FF",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue