File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -444,4 +444,28 @@ func TestMapValueGroupsEdgeCases(t *testing.T) {
444444 require .Error (t , err )
445445 assert .Contains (t , err .Error (), "every entry in a map value groups must have a name" )
446446 })
447+
448+ t .Run ("invalid map key types should fail" , func (t * testing.T ) {
449+ t .Parallel ()
450+
451+ type InvalidKeyParams struct {
452+ fx.In
453+ Services map [int ]testSimpleService `group:"services"`
454+ }
455+
456+ var params InvalidKeyParams
457+ app := NewForTest (t ,
458+ fx .Provide (
459+ fx .Annotate (
460+ func () testSimpleService { return & testBasicService {name : "test" } },
461+ fx .ResultTags (`name:"test" group:"services"` ),
462+ ),
463+ ),
464+ fx .Populate (& params ),
465+ )
466+
467+ err := app .Err ()
468+ require .Error (t , err )
469+ assert .Contains (t , err .Error (), "value groups may be consumed as slices or string-keyed maps only" )
470+ })
447471}
You can’t perform that action at this time.
0 commit comments