lean4-code-actions
Version:
Refactorings and snippets for Lean 4
18 lines (16 loc) • 433 B
text/typescript
import { pre } from 'fast-check'
import { AssertionFailedError } from '../error'
export function withSkips<Inputs extends unknown[], Output>(fn: (...inputs: Inputs) => Output) {
return function (...inputs: Inputs) {
try {
return fn(...inputs)
} catch (e) {
if (e instanceof AssertionFailedError) {
pre(false) // skip the test
return undefined
} else {
throw e
}
}
}
}