Skip to content

Commit

Permalink
unnest test
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Apr 6, 2021
1 parent 6c9af01 commit 134c59f
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions runtime/tests/interpreter/capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,47 +662,43 @@ func TestInterpretCapability_address(t *testing.T) {

t.Parallel()

t.Run("check address", func(t *testing.T) {

t.Parallel()

inter, _ := testAccount(
t,
true,
`
fun single(): Address {
return account.getCapability(/public/single).address
}
fun double(): Address {
return account.getCapability(/public/double).address
}
fun nonExistent() : Address {
return account.getCapability(/public/nonExistent).address
}
`,
)

t.Run("single", func(t *testing.T) {
value, err := inter.Invoke("single")
require.NoError(t, err)
inter, _ := testAccount(
t,
true,
`
fun single(): Address {
return account.getCapability(/public/single).address
}
fun double(): Address {
return account.getCapability(/public/double).address
}
fun nonExistent() : Address {
return account.getCapability(/public/nonExistent).address
}
`,
)

t.Run("single", func(t *testing.T) {
value, err := inter.Invoke("single")
require.NoError(t, err)

require.IsType(t, interpreter.AddressValue{}, value)
})
require.IsType(t, interpreter.AddressValue{}, value)
})

t.Run("double", func(t *testing.T) {
value, err := inter.Invoke("double")
require.NoError(t, err)
t.Run("double", func(t *testing.T) {
value, err := inter.Invoke("double")
require.NoError(t, err)

require.IsType(t, interpreter.AddressValue{}, value)
})
require.IsType(t, interpreter.AddressValue{}, value)
})

t.Run("nonExistent", func(t *testing.T) {
value, err := inter.Invoke("nonExistent")
require.NoError(t, err)
t.Run("nonExistent", func(t *testing.T) {
value, err := inter.Invoke("nonExistent")
require.NoError(t, err)

require.IsType(t, interpreter.AddressValue{}, value)
})
require.IsType(t, interpreter.AddressValue{}, value)
})

}

0 comments on commit 134c59f

Please sign in to comment.