Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed May 28, 2024
1 parent fac2646 commit 8464086
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion runtime/contract_update_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3103,6 +3103,30 @@ func TestPragmaUpdates(t *testing.T) {
require.ErrorAs(t, err, &expectedErr)
})

testWithValidators(t, "removedType pragma moved into subdeclaration", func(t *testing.T, withC1Upgrade bool) {

const oldCode = `
access(all) contract Test {
#removedType(bar)
access(all) struct S {
}
}
`

const newCode = `
access(all) contract Test {
access(all) struct S {
#removedType(bar)
}
}
`

err := testDeployAndUpdate(t, "Test", oldCode, newCode, withC1Upgrade)
var expectedErr *stdlib.TypeRemovalPragmaRemovalError
require.ErrorAs(t, err, &expectedErr)
})

testWithValidators(t, "reorder removedType pragmas", func(t *testing.T, withC1Upgrade bool) {

const oldCode = `
Expand Down Expand Up @@ -3221,7 +3245,7 @@ func TestPragmaUpdates(t *testing.T) {
require.NoError(t, err)
})

testWithValidators(t, "#removedType must remove a type", func(t *testing.T, withC1Upgrade bool) {
testWithValidators(t, "#removedType can be added without removing a type", func(t *testing.T, withC1Upgrade bool) {

const oldCode = `
access(all) contract Test {
Expand Down

0 comments on commit 8464086

Please sign in to comment.