ProofGeneral / PG

This repo is the new home of Proof General
https://proofgeneral.github.io
GNU General Public License v3.0
492 stars 89 forks source link

CI simple-tests: separate github action job for qRHL #713

Closed hendriktews closed 1 year ago

hendriktews commented 1 year ago

Separate qRHL tests in ci/simple-tests from Coq tests such that they can run in a separate action. Before, the qRHL test was running twice, as part of simple-tests and additionally in test-indent.

hendriktews commented 1 year ago

Hi @dominique-unruh, is this PR fine with you?

In your qRHL test you write, you would like to check keypress translations. Can you give an example?

dominique-unruh commented 1 year ago

@hendriktews

Hi @dominique-unruh, is this PR fine with you?

Yes.

In your qRHL test you write, you would like to check keypress translations. Can you give an example?

For example, I might want to check that, if I press the sequence *\subC, the buffer contains *⇩C afterwards. Currently, the test only checks whether the input method loads without errors, but not whether it does anything.

monnier commented 1 year ago

For example, I might want to check that, if I press the sequence *\subC, the buffer contains *⇩C afterwards. Currently, the test only checks whether the input method loads without errors, but not whether it does anything.

You should be able to cobble something up using unread-command-event, but it's messy. E.g. something like:

(ert-deftest my-test ()
  (with-temp-buffer
    ...enable-the-input-method-and-stuff...
    (catch 'my-exit
      (let ((unread-command-events (append "*\\subC" nil)))
        ;; To avoid the actual wait when the test is successful,
        ;; you can (in addition to the timer) setup a key-binding
        ;; that does the `throw` and add the corresponding key to
        ;; the `unread-command-events`.
        (run-with-timer 1 nil (lambda () (throw 'my-exit nil)))
        (recursive-edit)))
    (should (equal (buffer-string) "*⇩C"))))

-- Stefan

dominique-unruh commented 1 year ago

You should be able to cobble something up using unread-command-event, but it's messy.

If it's complicated, maybe best to leave those things untested instead. If it's brittle, we might end up spending time fixing or debugging the tests down the line.

hendriktews commented 1 year ago

merging now, continuing the discussion later

hendriktews commented 1 year ago

I ended up with

  ;; To simulate typing, we put the keys into `unread-command-events'.
  ;; To process them normally, we enter a recursive edit. To abort the
  ;; recursive edit, we add \C-\M-c, the binding of
  ;; `exit-recursive-edit' to the simulated keys.
  (setq unread-command-events (listify-key-sequence "*\\subC\C-\M-c"))
  (recursive-edit)
  (should (equal "*⇩C" (buffer-substring 1 (point))))

which seems to run relatively stable, see PR #714