github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/f/death_test.go (about)

     1  package f
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/smartystreets/goconvey/convey"
     7  )
     8  
     9  func TestDeathPkgPath(t *testing.T) {
    10  	Convey("Give pkgPath a ptr", t, func() {
    11  		c := &Closer{}
    12  		name, pkgPath := getPkgPath(c)
    13  		So(name, ShouldEqual, "Closer")
    14  		So(pkgPath, ShouldEqual, "github.com/vrecan/death")
    15  
    16  	})
    17  
    18  	Convey("Give pkgPath a interface", t, func() {
    19  		var closable Closable
    20  		closable = Closer{}
    21  		name, pkgPath := getPkgPath(closable)
    22  		So(name, ShouldEqual, "Closer")
    23  		So(pkgPath, ShouldEqual, "github.com/vrecan/death")
    24  	})
    25  
    26  	Convey("Give pkgPath a copy", t, func() {
    27  		c := Closer{}
    28  		name, pkgPath := getPkgPath(c)
    29  		So(name, ShouldEqual, "Closer")
    30  		So(pkgPath, ShouldEqual, "github.com/vrecan/death")
    31  	})
    32  }