summaryrefslogtreecommitdiff
path: root/Examples/test-suite/go/constructor_copy_runme.go
blob: ca4725549981b3305b9797135063531326d6a225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import . "swigtests/constructor_copy"

func main() {
	f1 := NewFoo1(3)
	f11 := NewFoo1(f1)

	if f1.GetX() != f11.GetX() {
		panic("f1/f11 x mismatch")
	}

	bi := NewBari(5)
	bc := NewBari(bi)

	if bi.GetX() != bc.GetX() {
		panic("bi/bc x mismatch")
	}

	bd := NewBard(5)
	good := false
	func() {
		defer func() {
			if recover() != nil {
				good = true
			}
		}()
		NewBard(bd)
	}()

	if !good {
		panic("bd !good")
	}
}