-
Notifications
You must be signed in to change notification settings - Fork 1
/
error_test.go
68 lines (56 loc) · 1.31 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package quirk
import (
"errors"
"testing"
. "github.com/franela/goblin"
)
func TestError(t *testing.T) {
g := Goblin(t)
g.Describe("Error", func() {
g.It("with external error", func() {
e := &Error{ExtErr: errors.New("err")}
g.Assert(e.Error()).
Equal(":: msg[] external_err[err]")
})
g.It("without external error", func() {
e := &Error{}
g.Assert(e.Error()).
Equal(":: msg[]")
})
})
}
func TestQueryError(t *testing.T) {
g := Goblin(t)
g.Describe("Query error", func() {
g.It("with external error", func() {
e := &QueryError{ExtErr: errors.New("err")}
g.Assert(e.Error()).
Equal(":query.go: Query[] external_err[err]")
})
g.It("with message", func() {
e := &QueryError{Msg: "msg"}
g.Assert(e.Error()).
Equal(":query.go: Msg[msg]")
})
g.It("empty", func() {
e := &QueryError{}
g.Assert(e.Error()).
Equal(":query.go: Query[]")
})
})
}
func TestTransactionError(t *testing.T) {
g := Goblin(t)
g.Describe("Error", func() {
g.It("with external error", func() {
e := &TransactionError{ExtErr: errors.New("err")}
g.Assert(e.Error()).
Equal(":mutate_single.go: Msg[] RDF[] external_err[err]")
})
g.It("without external error", func() {
e := &TransactionError{}
g.Assert(e.Error()).
Equal(":mutate_single.go: Msg[] RDF[]")
})
})
}