@@ -270,8 +270,11 @@ func TestStrictGapErrorRendering(t *testing.T) {
270270 // excludedOverlays / constraintWarnings are attached verbatim, and
271271 // absent rather than empty when there is nothing to report.
272272 if tt .excluded == nil {
273- if se .Context ["excludedOverlays" ] != nil {
274- t .Errorf ("excludedOverlays = %#v, want absent" , se .Context ["excludedOverlays" ])
273+ // Two-value lookup: a key present but holding nil is a
274+ // different wire shape from an absent key, and `!= nil`
275+ // cannot tell them apart.
276+ if v , present := se .Context ["excludedOverlays" ]; present {
277+ t .Errorf ("excludedOverlays = %#v, want the key absent" , v )
275278 }
276279 } else if got , ok := se .Context ["excludedOverlays" ].([]ExcludedOverlay ); ! ok {
277280 t .Errorf ("excludedOverlays = %#v, want []ExcludedOverlay" , se .Context ["excludedOverlays" ])
@@ -280,8 +283,8 @@ func TestStrictGapErrorRendering(t *testing.T) {
280283 }
281284
282285 if tt .warnings == nil {
283- if se .Context ["constraintWarnings" ] != nil {
284- t .Errorf ("constraintWarnings = %#v, want absent" , se . Context [ "constraintWarnings" ] )
286+ if v , present := se .Context ["constraintWarnings" ]; present {
287+ t .Errorf ("constraintWarnings = %#v, want the key absent" , v )
285288 }
286289 } else if got , ok := se .Context ["constraintWarnings" ].([]ConstraintWarning ); ! ok {
287290 t .Errorf ("constraintWarnings = %#v, want []ConstraintWarning" , se .Context ["constraintWarnings" ])
0 commit comments