Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed Jul 21, 2023
1 parent 6d98269 commit 29ccac3
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions runtime/tests/checker/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4500,6 +4500,42 @@ func TestNestedInterfaceInheritance(t *testing.T) {
require.NoError(t, err)
})

t.Run("all in one contract interface", func(t *testing.T) {

_, err := ParseAndCheck(t,
`
contract interface C {
resource interface TopInterface {}
resource interface MiddleInterface: TopInterface {}
fun createR(m: @{MiddleInterface}): @{TopInterface} {
return <-m
}
}
`,
)

require.NoError(t, err)
})

t.Run("all in one contract interface reverse order", func(t *testing.T) {

_, err := ParseAndCheck(t,
`
contract interface C {
resource interface MiddleInterface: TopInterface {}
resource interface TopInterface {}
fun createR(m: @{MiddleInterface}): @{TopInterface} {
return <-m
}
}
`,
)

require.NoError(t, err)
})

t.Run("contract interface", func(t *testing.T) {

_, err := ParseAndCheck(t,
Expand Down Expand Up @@ -4565,4 +4601,28 @@ func TestNestedInterfaceInheritance(t *testing.T) {
require.NoError(t, err)
})

t.Run("mixed with top levels", func(t *testing.T) {

_, err := ParseAndCheck(t,
`
contract C {
resource ConcreteResource: CI.MiddleInterface {}
fun createR(): @{SuperTopInterface} {
return <-create ConcreteResource()
}
}
contract C1 {
resource interface TopInterface: SuperTopInterface {}
}
contract interface CI {
resource interface MiddleInterface: C1.TopInterface {}
}
resource interface SuperTopInterface {}
`,
)

require.NoError(t, err)
})

}

0 comments on commit 29ccac3

Please sign in to comment.