mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
compiler: add test for foreign function inlining
This commit is contained in:
parent
9ee05d3241
commit
1828e79412
2 changed files with 14 additions and 0 deletions
|
@ -443,3 +443,13 @@ func TestInlineAppendStatement(t *testing.T) {
|
||||||
}`
|
}`
|
||||||
eval(t, src, []byte{1, 2, 3, 4, 5, 6})
|
eval(t, src, []byte{1, 2, 3, 4, 5, 6})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestInlineForeignType(t *testing.T) {
|
||||||
|
src := `package foo
|
||||||
|
import "github.com/nspcc-dev/neo-go/pkg/compiler/testdata/inline"
|
||||||
|
|
||||||
|
func Main() int {
|
||||||
|
return inline.ForeignTypeInsideInline()
|
||||||
|
}`
|
||||||
|
eval(t, src, big.NewInt(29))
|
||||||
|
}
|
||||||
|
|
4
pkg/compiler/testdata/inline/inline.go
vendored
4
pkg/compiler/testdata/inline/inline.go
vendored
|
@ -69,3 +69,7 @@ func AppendInsideInline(val []byte) []byte {
|
||||||
inlinedType := []byte{1, 2, 3}
|
inlinedType := []byte{1, 2, 3}
|
||||||
return append(inlinedType, val...)
|
return append(inlinedType, val...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ForeignTypeInsideInline() int {
|
||||||
|
return a.GetA()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue