Skip to content

Commit

Permalink
add tests for numscript account parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdupas22 committed Jan 25, 2024
1 parent b79b340 commit 986ca3a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions components/ledger/internal/machine/vm/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,51 @@ var runTestCases = []runTestCase{
AccountMetadata: map[string]metadata.Metadata{},
},
},
{
name: "send $42 dash",
script: `
send [USD/2 42] (
source = @world
destination = @user:001-toto
)`,
expectResult: Result{
Postings: []ledger.Posting{
ledger.NewPosting("world", "user:001-toto", "USD/2", big.NewInt(42)),
},
Metadata: metadata.Metadata{},
AccountMetadata: map[string]metadata.Metadata{},
},
},
{
name: "send $42 dash 2",
script: `
send [USD/2 42] (
source = @world
destination = @user:001-toto
)`,
expectResult: Result{
Postings: []ledger.Posting{
ledger.NewPosting("world", "user:001-toto", "USD/2", big.NewInt(42)),
},
Metadata: metadata.Metadata{},
AccountMetadata: map[string]metadata.Metadata{},
},
},
{
name: "send $42 dash 3",
script: `
send [USD/2 42] (
source = @world
destination = @--t-t--edd-st---
)`,
expectResult: Result{
Postings: []ledger.Posting{
ledger.NewPosting("world", "--t-t--edd-st---", "USD/2", big.NewInt(42)),
},
Metadata: metadata.Metadata{},
AccountMetadata: map[string]metadata.Metadata{},
},
},
{
name: "send all available",
script: `
Expand Down

0 comments on commit 986ca3a

Please sign in to comment.