@@ -3,13 +3,18 @@ package shutdown
33import (
44 "errors"
55 "testing"
6+
7+ "github.com/stretchr/testify/assert"
68)
79
810func TestNilShutdown (t * testing.T ) {
11+ defer ResetForTesting ()
912 finalize ("Should not fail" )
1013}
1114
1215func TestSimpleShutdown (t * testing.T ) {
16+ defer ResetForTesting ()
17+
1318 count := 0
1419
1520 func1 := func () error {
@@ -31,17 +36,9 @@ func TestSimpleShutdown(t *testing.T) {
3136 GetObserver ().AddCommand (func2 )
3237 GetObserver ().AddCommand (func3 )
3338
34- success , err := observerSingleton .executeCommands ()
35-
36- if count != 6 {
37- t .Fatal ("Wrong count after execution of commands: " , count , " should be " , 6 )
38- }
39+ success , failed := observerSingleton .executeCommands ()
3940
40- if success != 2 {
41- t .Fatal ("Success execution should be: 2 not " , success )
42- }
43-
44- if err != 1 {
45- t .Fatal ("Failed execution should be: 1 not " , err )
46- }
41+ assert .Equal (t , 6 , count , "count after execution of all commands" )
42+ assert .Equal (t , 2 , success , "successful executions" )
43+ assert .Equal (t , 1 , failed , "failed executions" )
4744}
0 commit comments