Skip to content

Commit

Permalink
Add test for multiline contract
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Feb 22, 2024
1 parent 5a73d83 commit 3778fcd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cmd/util/ledger/migrations/staged_contracts_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func TestStagedContractsFromCSV(t *testing.T) {
contracts, err := StagedContractsFromCSV(path)
require.NoError(t, err)

require.Len(t, contracts, 3)
require.Len(t, contracts, 4)
assert.Equal(
t,
contracts,
Expand All @@ -592,6 +592,22 @@ func TestStagedContractsFromCSV(t *testing.T) {
Code: []byte("access(all) contract Bar{}"),
},
},
{
Address: common.MustBytesToAddress([]byte{0x2}),
Contract: Contract{
Name: "MultilineContract",
Code: []byte(`
import Foo from 0x01
access(all)
contract MultilineContract{
init() {
var a = "hello"
}
}
`),
},
},
{
Address: common.MustBytesToAddress([]byte{0x2}),
Contract: Contract{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
0x0000000000000001,Foo,access(all) contract Foo{}
0x0000000000000001,Bar,access(all) contract Bar{}
0x0000000000000002,MultilineContract,"
import Foo from 0x01

access(all)
contract MultilineContract{
init() {
var a = ""hello""
}
}
"
0x0000000000000002,Baz,import Foo from 0x01 access(all) contract Baz{}

0 comments on commit 3778fcd

Please sign in to comment.