You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
fix(test/*): make sure tests produce no output (#3947)
Modify tests so that they produce no output. This also means removing all uses of `sorry`/`admit`.
Replace `#eval` by `run_cmd` consistently.
Tests that produced output before are modified so that it is checked that they roughly produce the right output
Add a trace option to the `#simp` command that turns the message of only if the expression is simplified to `true`. All tests are modified so that they simplify to `true`.
The randomized tests can produce output when they find a false positive, but that should basically never happen.
Add some docstings to `src/tactic/interactive`.
In this directory we collect various tests for the commands, tactics and metaprograms written in
4
+
mathlib (see [the tactic folder](../src/tactic)).
5
+
6
+
Tests for all tactics are highly encouraged, especially if they are used sparingly in mathlib.
7
+
Here are some guidelines for writing a test:
8
+
9
+
* Make sure that the test fails if something unexpected happens. Use `guard`, `guard_target`, `guard_hyp`, `get_decl` or similar tactics that fail if the tactic state is incorrect.
10
+
* Make sure that the test is silent, i.e. produces no output when it succeeds. This makes it easy to spot the tests that actually failed. Furthermore, it is unlikely that anyone will notice the output changing if the test keeps succeeding.
11
+
12
+
Some tips to make a test silent:
13
+
* Instead of `trace e`, write `guard (e = expected_expression)`.
14
+
* If you write a tactic/command that normally produces output, consider adding an option that silences it. See for example the uses of `set_option trace.silence_library_search true` in the [library_search](library_search) folder.
15
+
* Do not prove a lemma using `admit` or `sorry`. Instead make sure that the lemma is provable, and prove it by `assumption` or `trivial` or similar.
0 commit comments