MCPcopy Index your code
hub / github.com/expr-lang/expr / TestPanicsWithError

Function TestPanicsWithError

internal/testify/assert/assertions_test.go:1403–1429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1401}
1402
1403func TestPanicsWithError(t *testing.T) {
1404
1405 mockT := new(testing.T)
1406
1407 if !PanicsWithError(mockT, "panic", func() {
1408 panic(errors.New("panic"))
1409 }) {
1410 t.Error("PanicsWithError should return true")
1411 }
1412
1413 if PanicsWithError(mockT, "Panic!", func() {
1414 }) {
1415 t.Error("PanicsWithError should return false")
1416 }
1417
1418 if PanicsWithError(mockT, "at the disco", func() {
1419 panic(errors.New("panic"))
1420 }) {
1421 t.Error("PanicsWithError should return false")
1422 }
1423
1424 if PanicsWithError(mockT, "Panic!", func() {
1425 panic("panic")
1426 }) {
1427 t.Error("PanicsWithError should return false")
1428 }
1429}
1430
1431func TestNotPanics(t *testing.T) {
1432

Callers

nothing calls this directly

Calls 2

PanicsWithErrorFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…