MCPcopy Index your code
hub / github.com/DoNewsCode/core / TestLocationForPC

Function TestLocationForPC

di/optional_provider_test.go:60–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestLocationForPC(t *testing.T) {
61 g := core.New()
62 inlineCtor := func(f Fooer) Stub {
63 return Stub{}
64 }
65 g.Provide(di.Deps{di.LocationForPC(inlineCtor, reflect.ValueOf(badConstructor).Pointer())})
66
67 defer func() {
68 if r := recover(); r != nil {
69 assert.Contains(t, r.(error).Error(), "badConstructor")
70 return
71 }
72 t.Fatal("test should panic")
73 }()
74
75 g.Invoke(func(injected struct {
76 dig.In
77 Stub Stub
78 }) {
79 })
80}
81
82func TestChainedOptions(t *testing.T) {
83 g := core.New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
LocationForPCFunction · 0.92
ProvideMethod · 0.80
InvokeMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected