compiler: process packages in deterministic order
This commit is contained in:
parent
b771d2d024
commit
6f2759be3a
7 changed files with 72 additions and 1 deletions
|
@ -60,3 +60,24 @@ func TestInit(t *testing.T) {
|
|||
eval(t, src, big.NewInt(0))
|
||||
})
|
||||
}
|
||||
|
||||
func TestImportOrder(t *testing.T) {
|
||||
t.Run("1,2", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import _ "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg1"
|
||||
import _ "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg2"
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg3"
|
||||
func Main() int { return pkg3.A }`
|
||||
v := vmAndCompile(t, src)
|
||||
v.PrintOps()
|
||||
eval(t, src, big.NewInt(2))
|
||||
})
|
||||
t.Run("2,1", func(t *testing.T) {
|
||||
src := `package foo
|
||||
import _ "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg2"
|
||||
import _ "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg1"
|
||||
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/pkg3"
|
||||
func Main() int { return pkg3.A }`
|
||||
eval(t, src, big.NewInt(1))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue