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

Function TestDidPanic

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

Source from the content-addressed store, hash-verified

1333}
1334
1335func TestDidPanic(t *testing.T) {
1336
1337 const panicMsg = "Panic!"
1338
1339 if funcDidPanic, msg, _ := didPanic(func() {
1340 panic(panicMsg)
1341 }); !funcDidPanic || msg != panicMsg {
1342 t.Error("didPanic should return true, panicMsg")
1343 }
1344
1345 if funcDidPanic, msg, _ := didPanic(func() {
1346 panic(nil)
1347 }); !funcDidPanic || msg != nil {
1348 t.Error("didPanic should return true, nil")
1349 }
1350
1351 if funcDidPanic, _, _ := didPanic(func() {
1352 }); funcDidPanic {
1353 t.Error("didPanic should return false")
1354 }
1355
1356}
1357
1358func TestPanics(t *testing.T) {
1359

Callers

nothing calls this directly

Calls 2

didPanicFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…