This PR adds two features to the message testing commands:
## `#guard_panic` command
A new `#guard_panic` command that succeeds if the nested command
produces a panic message. Unlike `#guard_msgs`, it does not check the
exact message content, only that a panic occurred.
This is useful for testing commands that are expected to panic, where
the exact panic message text may be volatile. It is particularly useful
when minimizing a panic discovered "in the wild", while ensuring the
panic behaviour is preserved.
## `substring := true` option for `#guard_msgs`
Adds a `substring := true` option to `#guard_msgs` that checks if the
docstring appears as a substring of the output (after whitespace
normalization), rather than requiring an exact match. This is useful
when you only care about part of the message.
Example:
```lean
/-- Unknown identifier -/
#guard_msgs (substring := true) in
example : α := x
```
## Refactoring
Also refactors `runAndCollectMessages` as a shared helper function used
by both `#guard_msgs` and `#guard_panic`.
🤖 Prepared with Claude Code
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| bin | ||
| cmake | ||
| include/lean | ||
| Init | ||
| initialize | ||
| kernel | ||
| lake | ||
| Lean | ||
| library | ||
| runtime | ||
| shell | ||
| Std | ||
| util | ||
| cadical.mk | ||
| CMakeLists.txt | ||
| config.h.in | ||
| githash.h.in | ||
| Init.lean | ||
| lakefile.toml.in | ||
| lean-toolchain | ||
| Lean.lean | ||
| lean.mk.in | ||
| Leanc.lean | ||
| out | ||
| Std.lean | ||
| stdlib.make.in | ||
| stdlib_flags.h | ||
| version.h.in | ||