PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Go | 37 lines | 26 code | 11 blank | 0 comment | 6 complexity | 87d1490680d6ecbbecc1c3a15e2ce973 MD5 | raw file
 1package main
 2
 3import . "./director_finalizer"
 4
 5type MyFoo struct{} // From Foo
 6func DeleteMyFoo(p Foo) {
 7	p.OrStatus(2)
 8	DeleteFoo(p)
 9}
10
11func main() {
12	ResetStatus()
13
14	a := NewDirectorFoo(&MyFoo{})
15	DeleteMyFoo(a)
16
17	if GetStatus() != 3 {
18		panic(0)
19	}
20
21	ResetStatus()
22
23	a = NewDirectorFoo(&MyFoo{})
24	Launder(a)
25
26	if GetStatus() != 0 {
27		panic(0)
28	}
29
30	DeleteMyFoo(a)
31
32	if GetStatus() != 3 {
33		panic(0)
34	}
35
36	ResetStatus()
37}