Skip to content

Commit

Permalink
Add test case for invalid path
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrag00nv2 committed May 26, 2023
1 parent 1c7cc3d commit 017b4bb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions runtime/tests/interpreter/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,10 @@ func TestInterpretAuthAccount_borrow(t *testing.T) {
return account.borrow<&R2>(from: /storage/r)
}
fun checkR2WithInvalidPath(): Bool {
return account.check<@R2>(from: /storage/wrongpath)
}
fun changeAfterBorrow(): Int {
let ref = account.borrow<&R>(from: /storage/r)!
Expand Down Expand Up @@ -776,6 +780,17 @@ func TestInterpretAuthAccount_borrow(t *testing.T) {

require.ErrorAs(t, err, &interpreter.DereferenceError{})
})

t.Run("check R2 with wrong path", func(t *testing.T) {
checkRes, err := inter.Invoke("checkR2WithInvalidPath")
require.NoError(t, err)
AssertValuesEqual(
t,
inter,
interpreter.AsBoolValue(false),
checkRes,
)
})
})

t.Run("struct", func(t *testing.T) {
Expand Down

0 comments on commit 017b4bb

Please sign in to comment.