PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Go | 66 lines | 59 code | 7 blank | 0 comment | 11 complexity | 4b4f5a17360b4d65cb18f3813971eb24 MD5 | raw file
 1package main
 2
 3import "strings"
 4import "./threads_exception"
 5
 6func main() {
 7	t := threads_exception.NewTest()
 8
 9	error := true
10	func() {
11		defer func() {
12			error = recover() == nil
13		}()
14		t.Unknown()
15	}()
16	if error {
17		panic(0)
18	}
19
20	error = true
21	func() {
22		defer func() {
23			error = strings.Index(recover().(string), "int exception") == -1
24		}()
25		t.Simple()
26	}()
27	if error {
28		panic(0)
29	}
30
31	error = true
32	func() {
33		defer func() {
34			error = recover().(string) != "I died."
35		}()
36		t.Message()
37	}()
38	if error {
39		panic(0)
40	}
41
42	error = true
43	func() {
44		defer func() {
45			e := recover().(string)
46			error = strings.Index(e, "Exc exception") == -1
47		}()
48		t.Hosed()
49	}()
50	if error {
51		panic(0)
52	}
53
54	for i := 1; i < 4; i++ {
55		error = true
56		func() {
57			defer func() {
58				error = recover() == nil
59			}()
60			t.Multi(i)
61		}()
62		if error {
63			panic(0)
64		}
65	}
66}