compiler: add test for foreign function inlining

This commit is contained in:
Anna Shaleva 2022-09-27 15:36:06 +03:00
parent 9ee05d3241
commit 1828e79412
2 changed files with 14 additions and 0 deletions

View file

@ -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))
}

View file

@ -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()
}