/trunk/Examples/test-suite/go/smart_pointer_member_runme.go

# · Go · 30 lines · 23 code · 7 blank · 0 comment · 8 complexity · bb2712b232f15a26d2ace3f3c031629a MD5 · raw file

  1. package main
  2. import "fmt"
  3. import . "./smart_pointer_member"
  4. func main() {
  5. f := NewFoo()
  6. f.SetY(1)
  7. if f.GetY() != 1 {
  8. panic(0)
  9. }
  10. b := NewBar(f)
  11. b.SetY(2)
  12. if f.GetY() != 2 {
  13. fmt.Println(f.GetY())
  14. fmt.Println(b.GetY())
  15. panic(0)
  16. }
  17. if b.GetX() != f.GetX() {
  18. panic(0)
  19. }
  20. if b.GetZ() != GetFooZ() {
  21. panic(0)
  22. }
  23. }