prog: use all resource special values for opt args

This commit is contained in:
Dmitry Vyukov 2018-06-18 19:45:46 +02:00
parent af9f337ea6
commit 2dcee3b338

View File

@ -491,6 +491,10 @@ func (r *randGen) generateArgImpl(s *state, typ Type, ignoreSpecial bool) (arg A
}
if typ.Optional() && r.oneOf(5) {
if res, ok := typ.(*ResourceType); ok {
v := res.Desc.Values[r.Intn(len(res.Desc.Values))]
return MakeResultArg(typ, nil, v), nil
}
return r.target.defaultArg(typ), nil
}