We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc72af5 commit 6efdf2bCopy full SHA for 6efdf2b
mirror_test.go
@@ -2,6 +2,7 @@ package errors
2
3
import (
4
"errors"
5
+ "fmt"
6
"testing"
7
)
8
@@ -106,3 +107,17 @@ func TestIs(t *testing.T) {
106
107
})
108
}
109
110
+
111
+func TestAs(t *testing.T) {
112
+ // ref: https://github.com/golang/go/issues/37625#issuecomment-594045710
113
+ err := fmt.Errorf("fmt error")
114
+ target := &Error{}
115
+ if errors.As(err, &target) {
116
+ t.Error("As() = true, want false")
117
+ }
118
119
+ err = New("type *Error")
120
+ if !errors.As(err, &target) {
121
+ t.Error("As() = false, want true")
122
123
+}
0 commit comments