TestWithNilContext
Vladimir Bauer
9 years ago
| 37 | 37 | t.Error("ProgressBar didn't stop") |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | ||
| 41 | func TestWithNilContext(t *testing.T) { | |
| 42 | defer func() { | |
| 43 | if p := recover(); p != nil { | |
| 44 | if msg, ok := p.(string); ok && msg == "nil context" { | |
| 45 | return | |
| 46 | } | |
| 47 | t.Errorf("Expected nil context panic, got: %+v", p) | |
| 48 | } | |
| 49 | }() | |
| 50 | _ = mpb.New().WithContext(nil) | |
| 51 | } |