...
1 package ritesting
2
3 import (
4 "testing"
5
6 "github.com/dsoprea/go-logging"
7 )
8
9 func TestGetAndDisableMarshaledExits(t *testing.T) {
10 if exitsAreMarshaled != false {
11 t.Fatalf("Initial marhsaling state not correct.")
12 }
13
14 EnableMarshaledExits()
15
16 if exitsAreMarshaled != true {
17 t.Fatalf("Disabled state not correct.")
18 }
19
20 defer func() {
21 state := recover()
22 if state == nil {
23 t.Fatalf("main() didn't fail as expected")
24 }
25
26 err := state.(error)
27 if err.Error() != "marshaled exit of (88)" {
28 log.Panic(err)
29 }
30
31 DisableMarshaledExits()
32
33 if exitsAreMarshaled != false {
34 t.Fatalf("Final marhsaling state not correct.")
35 }
36 }()
37
38 Exit(88)
39 }
40
View as plain text