Skip to content

Commit

Permalink
Merge pull request #3559 from onflow/supun/add-test
Browse files Browse the repository at this point in the history
Add contract-update test for removing a field from nested resource
  • Loading branch information
SupunS authored Aug 30, 2024
2 parents 6e68b09 + 4db7867 commit e70d1be
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions runtime/contract_update_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,54 @@ func TestRuntimeContractUpdateValidation(t *testing.T) {
assertExtraneousFieldError(t, cause, "TestResource", "c")
})

testWithValidators(t, "remove field from nested decl", func(t *testing.T, config Config) {

const oldCode = `
access(all) contract Test {
access(all) var a: @TestResource
init() {
self.a <- create Test.TestResource()
}
access(all) resource TestResource {
access(all) var b: String
access(all) var c: Int
init() {
self.b = "hello"
self.c = 0
}
}
}
`

const newCode = `
access(all) contract Test {
access(all) var a: @Test.TestResource
init() {
self.a <- create Test.TestResource()
}
access(all) resource TestResource {
access(all) var b: String
init() {
self.b = "hello"
}
}
}
`

err := testDeployAndUpdate(t, "Test", oldCode, newCode, config)
require.NoError(t, err)
})

testWithValidators(t, "change indirect field type", func(t *testing.T, config Config) {

const oldCode = `
Expand Down

0 comments on commit e70d1be

Please sign in to comment.