neoneo-go/pkg/compiler/pointer_test.go
Evgenii Stratonikov eb047b12a7 compiler: support creating pointers to struct
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-08-04 11:14:07 +03:00

18 lines
280 B
Go

package compiler_test
import (
"math/big"
"testing"
)
func TestAddressOfLiteral(t *testing.T) {
src := `package foo
type Foo struct { A int }
func Main() int {
f := &Foo{}
setA(f, 3)
return f.A
}
func setA(s *Foo, a int) { s.A = a }`
eval(t, src, big.NewInt(3))
}