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