gitee.com/h79/goutils@v1.22.10/common/system/recover_test.go (about)

     1  package system
     2  
     3  import (
     4  	"gitee.com/h79/goutils/common"
     5  	"testing"
     6  	"time"
     7  )
     8  
     9  func TestNil(t *testing.T) {
    10  	order := "sdd"
    11  	common.IsNil(order)
    12  }
    13  
    14  func TestRecover(t *testing.T) {
    15  	type XXX struct {
    16  		I int
    17  	}
    18  	go func() {
    19  		defer Recover()
    20  		var xx *XXX
    21  
    22  		xx.I = 0
    23  	}()
    24  	time.Sleep(time.Second * 5)
    25  }