(opChain *chain, types ...int)
| 261 | } |
| 262 | |
| 263 | func (wm *WebsocketMessage) checkNotType(opChain *chain, types ...int) { |
| 264 | if opChain.failed() { |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | if len(types) == 0 { |
| 269 | opChain.fail(AssertionFailure{ |
| 270 | Type: AssertUsage, |
| 271 | Errors: []error{ |
| 272 | errors.New("missing type argument"), |
| 273 | }, |
| 274 | }) |
| 275 | return |
| 276 | } |
| 277 | |
| 278 | found := false |
| 279 | for _, t := range types { |
| 280 | if t == wm.typ { |
| 281 | found = true |
| 282 | break |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | if found { |
| 287 | if len(types) == 1 { |
| 288 | opChain.fail(AssertionFailure{ |
| 289 | Type: AssertNotEqual, |
| 290 | Actual: &AssertionValue{wsMessageType(wm.typ)}, |
| 291 | Expected: &AssertionValue{wsMessageType(types[0])}, |
| 292 | Errors: []error{ |
| 293 | errors.New("expected: message types are non-equal"), |
| 294 | }, |
| 295 | }) |
| 296 | } else { |
| 297 | typeList := make([]interface{}, 0, len(types)) |
| 298 | for _, t := range types { |
| 299 | typeList = append(typeList, wsMessageType(t)) |
| 300 | } |
| 301 | |
| 302 | opChain.fail(AssertionFailure{ |
| 303 | Type: AssertNotBelongs, |
| 304 | Actual: &AssertionValue{wsMessageType(wm.typ)}, |
| 305 | Expected: &AssertionValue{AssertionList(typeList)}, |
| 306 | Errors: []error{ |
| 307 | errors.New("expected: message type does not belong to given list"), |
| 308 | }, |
| 309 | }) |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // Code succeeds if WebSocket close code is one of the given. |
| 315 | // |
no test coverage detected