@@ -112,6 +112,22 @@ slots:
112112 c .Assert (slot .Attrs ["content" ], IsNil )
113113}
114114
115+ func (s * ContentSuite ) TestSanitizeSlotBadCompatibilityType (c * C ) {
116+ const mockSnapYaml = `name: content-slot-snap
117+ version: 1.0
118+ slots:
119+ content-slot:
120+ interface: content
121+ compatibility: 1
122+ read:
123+ - shared/read
124+ `
125+ info := snaptest .MockInfo (c , mockSnapYaml , nil )
126+ slot := info .Slots ["content-slot" ]
127+ c .Assert (interfaces .BeforePrepareSlot (s .iface , slot ), ErrorMatches ,
128+ `compatibility label must be a string` )
129+ }
130+
115131func (s * ContentSuite ) TestSanitizeSlotBothContentAndCompatLabels (c * C ) {
116132 const mockSnapYaml = `name: content-slot-snap
117133version: 1.0
@@ -252,6 +268,21 @@ plugs:
252268 c .Assert (plug .Attrs ["content" ], IsNil )
253269}
254270
271+ func (s * ContentSuite ) TestSanitizePlugBadCompatibilityType (c * C ) {
272+ const mockSnapYaml = `name: content-slot-snap
273+ version: 1.0
274+ plugs:
275+ content-plug:
276+ interface: content
277+ compatibility: 1
278+ target: import
279+ `
280+ info := snaptest .MockInfo (c , mockSnapYaml , nil )
281+ plug := info .Plugs ["content-plug" ]
282+ c .Assert (interfaces .BeforePreparePlug (s .iface , plug ), ErrorMatches ,
283+ `compatibility label must be a string` )
284+ }
285+
255286func (s * ContentSuite ) TestSanitizePlugBothContentAndCompatLabels (c * C ) {
256287 const mockSnapYaml = `name: content-slot-snap
257288version: 1.0
0 commit comments