gopkg.in/hedzr/errors.v3@v3.3.1/join_go1.11_test.go (about)

     1  // Copyright © 2023 Hedzr Yeh.
     2  
     3  //go:build go1.11
     4  // +build go1.11
     5  
     6  package errors_test
     7  
     8  import (
     9  	"errors"
    10  	"fmt"
    11  	"testing"
    12  
    13  	v3 "gopkg.in/hedzr/errors.v3"
    14  )
    15  
    16  func TestJoinErrorsStdFormatGo111(t *testing.T) {
    17  	err1 := errors.New("err1")
    18  	err2 := errors.New("err2")
    19  
    20  	err := v3.Join(err1, err2)
    21  
    22  	fmt.Printf("%T, %v\n", err, err)
    23  
    24  	if v3.Is(err, err1) {
    25  		t.Log("err is err1")
    26  	} else {
    27  		t.Fatal("FAILED: expecting err is err1")
    28  	}
    29  
    30  	if v3.Is(err, err2) {
    31  		t.Log("err is err2")
    32  	} else {
    33  		t.Fatal("FAILED: expecting err is err2")
    34  	}
    35  }