-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_test.go
42 lines (36 loc) · 931 Bytes
/
error_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package tagrunner
import (
"errors"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestRunnerError_Error(t *testing.T) {
Convey("root", t, func() {
err := &RunnerError{
TagKey: "key",
TagValue: "val",
TagArgs: nil,
FieldStructName: "sname",
FieldLabelName: "jname",
PassBy: 1,
raw: errors.New("test error"),
}
So(err.Error(), ShouldEqual, `test error
{"tag_key":"key","tag_value":"val","tag_args":null,"field_struct_name":"sname","field_label_name":"jname","pass_by":1}`)
})
}
func TestRunnerError_Unwrap(t *testing.T) {
Convey("root", t, func() {
e := errors.New("test error")
err := &RunnerError{
TagKey: "key",
TagValue: "val",
TagArgs: nil,
FieldStructName: "sname",
FieldLabelName: "jname",
PassBy: 1,
raw: e,
}
So(err.Unwrap(), ShouldEqual, e)
})
}