lean4-htt/tests/elab/add_suggestion.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

45 lines
1.7 KiB
Text

import Lean.Meta.Tactic.TryThis
set_option linter.unusedVariables false
set_option linter.missingDocs false
section width
-- here we test that the width of try this suggestions is not too big
-- simulate a long and complicated term
def longdef (a b : Nat) (h h h h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h : a = b) :
2 * a = 2 * b := by rw [h]
namespace Lean.Meta.Tactic.TryThis
open Lean Elab Tactic
set_option hygiene false in
elab "test" : tactic => do
addSuggestion (← getRef) (←
`(tactic| exact longdef a b h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h h
h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h))
end Lean.Meta.Tactic.TryThis
#guard_msgs (drop info, drop warning) in
-- ideally we would have a #guard_widgets or #guard_infos too, but instead we can simply check by
-- hand that the widget suggestion (not the message) fits into 100 columns
theorem asda (a b : Nat) (h : a = b) : 2 * a = 2 * b := by
test
--exact
-- longdef a b h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h
-- h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h
-- h h h h h
have : 2 * a = 2 * b := by
test
-- exact
-- longdef a b h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h
-- h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h h
-- h h h h h h h
sorry
sorry