Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contract-update test for removing a field from nested resource #3559

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading