Closed defval closed 3 years ago
Test case (container_test:840):
t.Run("constructor with injectable embed pointer", func(t *testing.T) { c, err := di.New() require.NoError(t, err) type InjectableType struct { di.Inject *http.ServeMux } mux := &http.ServeMux{} require.NoError(t, c.Provide(func() *http.ServeMux { return mux })) require.NoError(t, c.Provide(func() *InjectableType { return &InjectableType{} })) var result *InjectableType require.NoError(t, c.Resolve(&result)) require.NotNil(t, result.ServeMux) require.Equal(t, fmt.Sprintf("%p", mux), fmt.Sprintf("%p", result.ServeMux)) })
Added in v1.7.0
Test case (container_test:840):