lean4-htt/src
Kim Morrison a6ed0d640d
feat: add #guard_panic command and substring option for #guard_msgs (#11908)
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>
2026-01-07 01:34:49 +00:00
..
bin
cmake
include/lean fix: avoid SIGFPE on x86_64 for signed integer division overflow (#11624) 2025-12-13 02:42:33 +00:00
Init feat: add #guard_panic command and substring option for #guard_msgs (#11908) 2026-01-07 01:34:49 +00:00
initialize
kernel perf: use lean::unordered_set for expr_eq_fn (#11731) 2025-12-18 14:24:50 +00:00
lake fix: add table variant for require.git field in lakefile.toml schema (#11536) 2025-12-16 10:47:33 +00:00
Lean feat: add #guard_panic command and substring option for #guard_msgs (#11908) 2026-01-07 01:34:49 +00:00
library perf: do not consult isNoConfusion in whnf (#11571) 2025-12-09 23:36:46 +00:00
runtime chore: fix typo (#11883) 2026-01-03 11:36:50 +00:00
shell chore: tests: use filenames as test names (#11302) 2025-11-21 12:40:58 +00:00
Std feat: use MonadAttach in the takeWhileM and dropWhileM iterator combinators (#11852) 2025-12-31 12:38:21 +00:00
util refactor: port shell option processing to Lean (v2) (#11434) 2025-12-02 17:41:51 +00:00
cadical.mk
CMakeLists.txt chore: begin development cycle for v4.28.0 (#11667) 2025-12-14 12:42:12 +00:00
config.h.in
githash.h.in
Init.lean feat: port Batteries.WF for executable well-founded fixpoints (#11620) 2025-12-12 18:22:54 +00:00
lakefile.toml.in feat: module system is no longer experimental (#11637) 2025-12-12 21:20:26 +00:00
lean-toolchain
Lean.lean refactor: move error explanation text to the manual (#11688) 2025-12-26 17:14:58 +00:00
lean.mk.in
Leanc.lean
out
Std.lean
stdlib.make.in
stdlib_flags.h chore: remove comment from wrong stdlib_flags.h (#11646) 2025-12-12 22:59:38 +00:00
version.h.in