test(frontend): Circular sorry

This commit is contained in:
Leni Aniva 2025-07-13 23:09:37 -07:00
parent dabd52a5fc
commit 559e2bc84d
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
1 changed files with 19 additions and 0 deletions

View File

@ -201,6 +201,24 @@ example (α : Type) [Inhabited α] : α := sorry
| .invalidAction e =>
fail s!"Invalid action: {e}"
def test_sorry_circular : TestT MetaM Unit := do
let sketch := "
theorem test (p q : Prop) (hp : p) (hq : q) : p ∧ q ∧ p := by sorry
"
let goalStates ← (collectSorrysFromSource sketch).run' {}
let [goalState] := goalStates | panic! s!"Incorrect number of states: {goalStates.length}"
let result ← runTermElabMInMeta $ goalState.tryTactic .unfocus "exact test α"
checkTrue "failure" $ result matches .failure ..
match result with
| .success .. =>
fail s!"This should not succeed"
| .failure .. =>
return ()
| .parseError e =>
fail s!"Parse error: {e}"
| .invalidAction e =>
fail s!"Invalid action: {e}"
def test_environment_capture: TestT MetaM Unit := do
let sketch := "
def mystery (n: Nat) := n + 1
@ -280,6 +298,7 @@ def suite (env : Environment): List (String × IO LSpec.TestSeq) :=
("sorry in induction", test_sorry_in_induction),
("sorry in coupled", test_sorry_in_coupled),
("sorry with local instances", test_sorry_with_local_instance),
("sorry circular", test_sorry_circular),
("environment_capture", test_environment_capture),
("capture_type_mismatch", test_capture_type_mismatch),
--("capture_type_mismatch_in_binder", test_capture_type_mismatch_in_binder),