gitee.com/h79/goutils@v1.22.10/common/result/result_test.go (about)

     1  package result
     2  
     3  import "testing"
     4  
     5  type xxxx struct {
     6  	Result
     7  }
     8  
     9  func (x xxxx) ToResult() Result {
    10  	return x.Result
    11  }
    12  
    13  func TestNew(t *testing.T) {
    14  
    15  	res, _ := RErrAuth.(Result)
    16  
    17  	t.Logf("Result:  %+v", res.Errno)
    18  
    19  	r := WithErr(Result{
    20  		Errno: 1,
    21  	})
    22  	t.Logf("Result:  %+v", r.Errno)
    23  
    24  	x := xxxx{Result{Desc: "XXXXX"}}
    25  	res1, _ := Case(x)
    26  
    27  	t.Logf("%v", res1)
    28  }