(t *testing.T)
| 1585 | } |
| 1586 | |
| 1587 | func TestPanicsWithError(t *testing.T) { |
| 1588 | t.Parallel() |
| 1589 | |
| 1590 | mockT := new(testing.T) |
| 1591 | |
| 1592 | if !PanicsWithError(mockT, "panic", func() { |
| 1593 | panic(errors.New("panic")) |
| 1594 | }) { |
| 1595 | t.Error("PanicsWithError should return true") |
| 1596 | } |
| 1597 | |
| 1598 | if PanicsWithError(mockT, "Panic!", func() { |
| 1599 | }) { |
| 1600 | t.Error("PanicsWithError should return false") |
| 1601 | } |
| 1602 | |
| 1603 | if PanicsWithError(mockT, "at the disco", func() { |
| 1604 | panic(errors.New("panic")) |
| 1605 | }) { |
| 1606 | t.Error("PanicsWithError should return false") |
| 1607 | } |
| 1608 | |
| 1609 | if PanicsWithError(mockT, "Panic!", func() { |
| 1610 | panic("panic") |
| 1611 | }) { |
| 1612 | t.Error("PanicsWithError should return false") |
| 1613 | } |
| 1614 | } |
| 1615 | |
| 1616 | func TestNotPanics(t *testing.T) { |
| 1617 | t.Parallel() |
nothing calls this directly
no test coverage detected