Skip to content

Commit f5cde44

Browse files
committed
omit-proofs tests: add new test for bullets and braces
Currently bullets and braces are classified as commands that prevent proof omission, therefore proofs containing bullets or braces are never omitted. The new tests is therefore expected to fail.
1 parent cb23709 commit f5cde44

File tree

2 files changed

+56
-18
lines changed

2 files changed

+56
-18
lines changed

ci/simple-tests/coq-test-omit-proofs.el

+36-14
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ In particular, test that with proof-omit-proofs-option configured:
106106

107107
;; Check 1: check that the proof is valid and omit can be disabled
108108
(message "1: check that the proof is valid and omit can be disabled")
109-
(should (search-forward "automatic test marker 4" nil t))
109+
(should (search-forward "automatic test marker 4 " nil t))
110110
(forward-line -1)
111111
;; simulate C-u prefix argument
112112
(proof-goto-point '(4))
@@ -140,19 +140,19 @@ In particular, test that with proof-omit-proofs-option configured:
140140

141141
;; Check 2: check proof-locked-face is active at marker 2 and 3
142142
(message "2: check proof-locked-face is active at marker 2 and 3")
143-
(should (search-backward "automatic test marker 2" nil t))
143+
(should (search-backward "automatic test marker 2 " nil t))
144144
(should (eq (first-overlay-face) 'proof-locked-face))
145-
(should (search-forward "automatic test marker 3" nil t))
145+
(should (search-forward "automatic test marker 3 " nil t))
146146
(should (eq (first-overlay-face) 'proof-locked-face))
147147

148148
;; Check 3: check that the second proof is omitted
149149
(message "3: check that the second proof is omitted")
150150
;; first retract
151-
(should (search-backward "automatic test marker 1" nil t))
151+
(should (search-backward "automatic test marker 1 " nil t))
152152
(proof-goto-point)
153153
(wait-for-coq)
154154
;; move forward again
155-
(should (search-forward "automatic test marker 4" nil t))
155+
(should (search-forward "automatic test marker 4 " nil t))
156156
(forward-line -1)
157157
(proof-goto-point)
158158
(wait-for-coq)
@@ -174,7 +174,7 @@ In particular, test that with proof-omit-proofs-option configured:
174174

175175
;; Check 4: check proof-omitted-proof-face is active at marker 3
176176
(message "4: check proof-omitted-proof-face is active at marker 3")
177-
(should (search-backward "automatic test marker 3" nil t))
177+
(should (search-backward "automatic test marker 3 " nil t))
178178
;; debug overlay order
179179
;; (mapc
180180
;; (lambda (ov)
@@ -185,17 +185,17 @@ In particular, test that with proof-omit-proofs-option configured:
185185

186186
;; Check 5: check proof-locked-face is active at marker 1 and 2
187187
(message "5: check proof-locked-face is active at marker 1 and 2")
188-
(should (search-backward "automatic test marker 1" nil t))
188+
(should (search-backward "automatic test marker 1 " nil t))
189189
(should (eq (first-overlay-face) 'proof-locked-face))
190-
(should (search-forward "automatic test marker 2" nil t))
190+
(should (search-forward "automatic test marker 2 " nil t))
191191
(should (eq (first-overlay-face) 'proof-locked-face))
192192

193193
;; Check 6: check that a partial proof at the end is not omitted
194194
(message "6: check that a partial proof at the end is not omitted")
195195
(goto-char (point-min))
196196
(proof-goto-point)
197197
(wait-for-coq)
198-
(should (search-forward "automatic test marker 3" nil t))
198+
(should (search-forward "automatic test marker 3 " nil t))
199199
(forward-line 2)
200200
(proof-goto-point)
201201
(wait-for-coq)
@@ -223,11 +223,11 @@ The sources for the test contain a local attribute in form of
223223
(goto-char (point-min))
224224
;; Check that proofs with Hint commands are never omitted
225225
(message "Check that proofs with Hint commands are never omitted")
226-
(should (search-forward "automatic test marker 6" nil t))
226+
(should (search-forward "automatic test marker 6 " nil t))
227227
(forward-line -1)
228228
(proof-goto-point)
229229
(wait-for-coq)
230-
(should (search-backward "automatic test marker 5" nil t))
230+
(should (search-backward "automatic test marker 5 " nil t))
231231
(should (eq (first-overlay-face) 'proof-locked-face)))
232232

233233

@@ -245,14 +245,36 @@ This test only checks the faces in the middle of the proof."
245245
(goto-char (point-min))
246246
;; Check that proofs for Let local declarations are never omitted.
247247
(message "Check that proofs for Let local declarations are never omitted.")
248-
(should (search-forward "automatic test marker 8" nil t))
248+
(should (search-forward "automatic test marker 8 " nil t))
249249
(forward-line -1)
250250
(proof-goto-point)
251251
(wait-for-coq)
252-
(should (search-backward "automatic test marker 7-1" nil t))
252+
(should (search-backward "automatic test marker 7-1 " nil t))
253253
(should (eq (first-overlay-face) 'proof-locked-face))
254254

255255
;; Check that theorems behind Let definitions are omitted.
256256
(message "Check that theorems behind Let definitions are omitted.")
257-
(should (search-forward "automatic test marker 7-2" nil t))
257+
(should (search-forward "automatic test marker 7-2 " nil t))
258258
(should (eq (first-overlay-face) 'proof-omitted-proof-face)))
259+
260+
(ert-deftest omit-proofs-omit-bullets-and-braces ()
261+
:expected-result :failed
262+
(let ((proof-omit-proofs-option t)
263+
pos-10)
264+
(message "omit-proofs-omit-bullets-and-braces: Check bullets and braces")
265+
(reset-coq)
266+
(find-file "omit_test.v")
267+
(goto-char (point-min))
268+
;; Check that proofs with bullets and braces are omitted
269+
(message "Check that proofs with bullets and braces are omitted")
270+
(should (search-forward "automatic test marker 10 " nil t))
271+
(setq pos-10 (point))
272+
(forward-line 1)
273+
(proof-goto-point)
274+
(wait-for-coq)
275+
(goto-char pos-10)
276+
;; Comment behind should be locked
277+
(should (eq (first-overlay-face) 'proof-locked-face))
278+
;; Proof with bullets and braces should be omitted
279+
(should (search-backward "automatic test marker 9 " nil t))
280+
(should (eq (first-overlay-face) 'proof-omitted-proof-face))))

ci/simple-tests/omit_test.v

+20-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
*
99
* Lemma never_omit_hints is for test omit-proofs-never-omit-hints: Proofs
1010
* containing commands should never be skipped (except for a few white-listed
11-
* commands.
11+
* commands).
1212
*
13-
* Lemma never_omit_let is for test omit-proofs-never-omit-lets: Proofs of
14-
* let-theorems should never be omitted.
13+
* Lemma never_omit_let and behind_let is for test
14+
* omit-proofs-never-omit-lets: Proofs of let-theorems should never be
15+
* omitted while proofs behind let declarations should.
1516
*
17+
* Lemma omit_bullets_and_braces is for test
18+
* omit-proofs-omit-bullets-and-braces: Proofs with bullets and braces
19+
* should be omitted.
1620
*)
1721

18-
1922
Definition classical_logic : Prop := forall(P : Prop), ~~P -> P.
2023

2124
(* automatic test marker 1 *)
@@ -70,3 +73,16 @@ Proof using.
7073
Qed.
7174

7275
(* automatic test marker 6 *)
76+
77+
Lemma omit_bullets_and_braces : True /\ (True /\ True).
78+
Proof using.
79+
split.
80+
- trivial.
81+
- { split.
82+
++ trivial.
83+
(* automatic test marker 9 *)
84+
++ trivial.
85+
}
86+
Qed.
87+
88+
(* automatic test marker 10 *)

0 commit comments

Comments
 (0)