lean4-htt/tests/elab/versoDocWarningsErrors.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

99 lines
1.8 KiB
Text

import Lean
set_option doc.verso true
/-!
This test checks that suggestions for error/warnings flags are provided correctly by the {lit}`lean`
code block in Verso docstrings, and that the messages are saved correctly.
-/
/--
error: Unexpected warning:
declaration uses `sorry`
Hint: The `+warning` flag indicates that warnings are expected:
lean ̲+̲w̲a̲r̲n̲i̲n̲g̲
-/
#guard_msgs in
/-!
```lean
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := sorry
```
-/
/--
error: Unexpected warning:
declaration uses `sorry`
Hint: The `+warning` flag indicates that warnings are expected:
lean ̲+̲w̲a̲r̲n̲i̲n̲g̲
-/
#guard_msgs in
/-!
```lean
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := sorry
```
-/
-- Also test that adding +warning makes the warning expected (no error)
#guard_msgs in
/-!
```lean +warning
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := sorry
```
-/
-- And that the output is saved
#guard_msgs in
/-!
```lean +warning (name := w)
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := sorry
```
```output w
declaration uses `sorry`
```
-/
/--
error: Unexpected error:
Type mismatch
True.intro
has type
True
but is expected to have type
∃ n, Int.ofNat n = z
Hint: The `+error` flag indicates that errors are expected:
lean ̲+̲e̲r̲r̲o̲r̲
-/
#guard_msgs in
/-!
```lean
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := True.intro
```
-/
-- Also test that adding +error makes the error expected (no error)
#guard_msgs in
/-!
```lean +error
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := True.intro
```
-/
-- And that the output is saved
#guard_msgs in
/-!
```lean +error (name := w)
theorem int_eq_nat {z : Int} : ∃ n, Int.ofNat n = z := True.intro
```
```output w
Type mismatch
True.intro
has type
True
but is expected to have type
∃ n, Int.ofNat n = z
```
-/