@@ -7,11 +7,11 @@ import (
77 "testing"
88 "time"
99
10+ "github.com/barnettZQG/inject"
1011 "github.com/facebookgo/ensure"
11- "github.com/facebookgo/inject"
1212
13- injecttesta "github.com/facebookgo /inject/injecttesta"
14- injecttestb "github.com/facebookgo /inject/injecttestb"
13+ injecttesta "github.com/barnettZQG /inject/test /injecttesta"
14+ injecttestb "github.com/barnettZQG /inject/test /injecttestb"
1515)
1616
1717func init () {
@@ -24,7 +24,8 @@ type Answerable interface {
2424}
2525
2626type TypeAnswerStruct struct {
27- answer int
27+ answer int
28+ //nolint
2829 private int
2930}
3031
@@ -156,6 +157,7 @@ func TestPrivate(t *testing.T) {
156157}
157158
158159type TypeWithJustColon struct {
160+ //nolint:govet
159161 A * TypeAnswerStruct `inject:`
160162}
161163
@@ -168,11 +170,13 @@ func TestTagWithJustColon(t *testing.T) {
168170
169171 const msg = "unexpected tag format `inject:` for field A in type *inject_test.TypeWithJustColon"
170172 if err .Error () != msg {
171- t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
173+ var a TypeWithJustColon
174+ t .Fatalf ("expected:\n %s\n actual:\n %s %v" , msg , err .Error (), a .A )
172175 }
173176}
174177
175178type TypeWithOpenQuote struct {
179+ //nolint:govet
176180 A * TypeAnswerStruct `inject:"`
177181}
178182
@@ -185,7 +189,7 @@ func TestTagWithOpenQuote(t *testing.T) {
185189
186190 const msg = "unexpected tag format `inject:\" ` for field A in type *inject_test.TypeWithOpenQuote"
187191 if err .Error () != msg {
188- t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
192+ t .Fatalf ("expected:\n %s\n actual:\n %s %v " , msg , err .Error (), a . A )
189193 }
190194}
191195
@@ -238,7 +242,7 @@ func TestProvideTwoOfTheSame(t *testing.T) {
238242 t .Fatal ("expected error" )
239243 }
240244
241- const msg = "provided two unnamed instances of type *github.com/facebookgo /inject_test.TypeAnswerStruct"
245+ const msg = "provided two unnamed instances of type *github.com/barnettZQG /inject_test.TypeAnswerStruct"
242246 if err .Error () != msg {
243247 t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
244248 }
@@ -251,7 +255,7 @@ func TestProvideTwoOfTheSameWithPopulate(t *testing.T) {
251255 t .Fatal ("expected error" )
252256 }
253257
254- const msg = "provided two unnamed instances of type *github.com/facebookgo /inject_test.TypeAnswerStruct"
258+ const msg = "provided two unnamed instances of type *github.com/barnettZQG /inject_test.TypeAnswerStruct"
255259 if err .Error () != msg {
256260 t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
257261 }
@@ -465,10 +469,6 @@ func TestInjectOnPrivateField(t *testing.T) {
465469 }
466470}
467471
468- type TypeWithInjectOnPrivateInterfaceField struct {
469- a Answerable `inject:""`
470- }
471-
472472func TestInjectOnPrivateInterfaceField (t * testing.T ) {
473473 var a TypeWithInjectOnPrivateField
474474 err := inject .Populate (& a )
@@ -478,7 +478,7 @@ func TestInjectOnPrivateInterfaceField(t *testing.T) {
478478
479479 const msg = "inject requested on unexported field a in type *inject_test.TypeWithInjectOnPrivateField"
480480 if err .Error () != msg {
481- t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
481+ t .Fatalf ("expected:\n %s\n actual:\n %s %v " , msg , err .Error (), a . a )
482482 }
483483}
484484
@@ -561,7 +561,7 @@ func TestInjectNamedOnPrivateInterfaceField(t *testing.T) {
561561
562562 const msg = "inject requested on unexported field a in type *inject_test.TypeWithInjectNamedOnPrivateInterfaceField"
563563 if err .Error () != msg {
564- t .Fatalf ("expected:\n %s\n actual:\n %s" , msg , err .Error ())
564+ t .Fatalf ("expected:\n %s\n actual:\n %s %v " , msg , err .Error (), v . a )
565565 }
566566}
567567
0 commit comments