@@ -446,7 +446,47 @@ For example, COMMENT could be (*test-definition*)"
446
446
(coq-test-goto-before " (*proof*)" )
447
447
(backward-char 3 )
448
448
(should (span-at (point ) 'proofusing ))))))
449
-
449
+
450
+
451
+
452
+ (ert-deftest 110_coq-test-regression_error_on_fst_cmd ()
453
+ " Test error highlghting in the first line."
454
+ (coq-fixture-on-file
455
+ (coq-test-full-path " test_error_loc_fst_cmd.v" )
456
+ (lambda ()
457
+ (coq-test-goto-before " (*after-error*)" )
458
+ ; ; redefining this function locally so that self removing spans
459
+ ; ; remain longer. Cf span.el
460
+ (cl-letf (((symbol-function 'span-make-self-removing-span )
461
+ (lambda (beg end &rest props )
462
+ (let ((ol (span-make beg end)))
463
+ (while props
464
+ (overlay-put ol (car props) (cadr props))
465
+ (setq props (cddr props)))
466
+ (add-timeout 10 'delete-overlay ol)
467
+ ol))))
468
+
469
+ (let ((proof-cmd-point (save-excursion
470
+ (coq-test-goto-before " (*after-error*)" )
471
+ (re-search-backward " bar" ))))
472
+ (coq-test-goto-after " (*after-error*)" )
473
+ (proof-goto-point)
474
+ (proof-shell-wait)
475
+ (coq-should-buffer-string " Error: The reference bar was not found in the current environment." )
476
+ ; ; checking that there is an overlay with warning face
477
+ ; ; exactly on "bar". WARNING: this overlay lasts only for 12
478
+ ; ; secs (thx to the add-timeout above), if this test is done
479
+ ; ; in a (very) slow virtual machine this may fail.
480
+ (should (equal (point ) proof-cmd-point))
481
+ (let ((sp (span-at proof-cmd-point 'face )))
482
+ (should sp)
483
+ (should (equal (span-property sp 'face ) 'proof-warning-face ))
484
+ (should (equal (span-start sp) proof-cmd-point))
485
+ ; ; coq-8.11 used to hace ending ps shifted by one
486
+ (should (or (equal (span-end sp) (+ proof-cmd-point (length " bar" )))
487
+ (equal (span-end sp) (+ 1 proof-cmd-point (length " bar" )))))
488
+ )
489
+ (should (equal (proof-queue-or-locked-end) (point-min ))))))))
450
490
(provide 'coq-tests )
451
491
452
492
; ;; coq-tests.el ends here
0 commit comments