Skip to content

Commit dca1aab

Browse files
committed
WIP test
1 parent 925ffa8 commit dca1aab

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

internal/interpreter/interpreter_test.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5593,3 +5593,72 @@ func TestVirtualSendCreditAround(t *testing.T) {
55935593
}
55945594
test(t, tc)
55955595
}
5596+
5597+
func TestVirtualKept(t *testing.T) {
5598+
script := `
5599+
vars {
5600+
account $v1 = virtual()
5601+
}
5602+
5603+
send [USD 1] (
5604+
source = @v1
5605+
destination = $v1
5606+
)
5607+
5608+
send [USD 2] (
5609+
source = $v2
5610+
destination = @dest
5611+
)
5612+
5613+
send [USD 1] (
5614+
// that's why this doesn't output any postings
5615+
source = @world
5616+
destination = $v2
5617+
)
5618+
`
5619+
5620+
tc := NewTestCase()
5621+
tc.compile(t, script)
5622+
5623+
tc.expected = CaseResult{
5624+
Postings: []machine.Posting{},
5625+
}
5626+
test(t, tc)
5627+
}
5628+
5629+
func TestVirtualSendCreditAroundMixed(t *testing.T) {
5630+
t.Skip("TODO impl test")
5631+
5632+
script := `
5633+
vars {
5634+
account $v1 = virtual()
5635+
account $v2 = virtual()
5636+
}
5637+
5638+
send [USD 1] (
5639+
source = $v1 allowing unbounded overdraft
5640+
destination = $v2
5641+
)
5642+
5643+
send [USD 2] (
5644+
// here's we're sending the credit we have from $v1
5645+
// so $v2 doesn't "owe" anything to @dest
5646+
source = $v2
5647+
destination = @dest
5648+
)
5649+
5650+
send [USD 1] (
5651+
// that's why this doesn't output any postings
5652+
source = @world
5653+
destination = $v2
5654+
)
5655+
`
5656+
5657+
tc := NewTestCase()
5658+
tc.compile(t, script)
5659+
5660+
tc.expected = CaseResult{
5661+
Postings: []machine.Posting{},
5662+
}
5663+
test(t, tc)
5664+
}

0 commit comments

Comments
 (0)