-
Notifications
You must be signed in to change notification settings - Fork 20
/
pkgPath_test.go
43 lines (34 loc) · 844 Bytes
/
pkgPath_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
package death
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestGetPkgPath(t *testing.T) {
Convey("Give pkgPath a ptr", t, func() {
c := &Closer{}
name, pkgPath := getPkgPath(c)
So(name, ShouldEqual, "Closer")
So(pkgPath, ShouldEqual, "github.com/vrecan/death/v3")
})
Convey("Give pkgPath a interface", t, func() {
var closable Closable
closable = Closer{}
name, pkgPath := getPkgPath(closable)
So(name, ShouldEqual, "Closer")
So(pkgPath, ShouldEqual, "github.com/vrecan/death/v3")
})
Convey("Give pkgPath a copy", t, func() {
c := Closer{}
name, pkgPath := getPkgPath(c)
So(name, ShouldEqual, "Closer")
So(pkgPath, ShouldEqual, "github.com/vrecan/death/v3")
})
}
type Closable interface {
Close() error
}
type Closer struct {
}
func (c Closer) Close() error {
return nil
}