Skip to content

Commit

Permalink
Define two test commands as an alternative to test -T all etc.; use…
Browse files Browse the repository at this point in the history
… this in CI workflow.
  • Loading branch information
doublep committed Sep 20, 2023
1 parent 94d5435 commit ffb7aec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
ELDEV_LOCAL: "."

- name: Test integration
run: ./bin/eldev -p -dtTC test --test-type integration --omit-backtraces --expect 30
run: ./bin/eldev -p -dtTC test-integration --omit-backtraces --expect 30
env:
ELDEV_LOCAL: "."

Expand Down
19 changes: 19 additions & 0 deletions Eldev
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@
(signal 'eldev-wrong-option-usage `("unknown test type `%s'" ,type)))
(setf eldev-test-type (intern type)))

(eldev-defcommand eldev-test-all (&rest parameters)
"Same as `test --test-type=all'."
:custom-parsing t
:category testing
(let ((parsed (eldev-parse-command-line parameters :command 'test-all)))
(eldev-test-selection "all")
(apply #'eldev-test (plist-get parsed :without-options))))

(eldev-defcommand eldev-test-integration (&rest parameters)
"Same as `test --test-type=integration'."
:custom-parsing t
:category testing
(let ((parsed (eldev-parse-command-line parameters :command 'test-integration)))
(eldev-test-selection "integration")
(apply #'eldev-test (plist-get parsed :without-options))))

(eldev-inherit-options 'test-all 'test (lambda (_option handler) (not (eq handler #'eldev-test-selection))))
(eldev-inherit-options 'test-integration 'test-all)

(add-hook 'eldev-test-hook
(lambda ()
(eldev-verbose "Using Eldev tests of type `%s'" eldev-test-type)
Expand Down
3 changes: 1 addition & 2 deletions test/project-g/Eldev
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
:command test-integration
:custom-parsing t
:category testing
(let* ((parsed (eldev-parse-command-line parameters :command 'test-integration))
(command-line (plist-get parsed :all-options)))
(let ((parsed (eldev-parse-command-line parameters :command 'test-integration)))
(when (plist-get parsed :without-options)
(signal 'eldev-wrong-command-usage `(t "Too many command parameters")))
(eldev-test "test-g-integration.el")))
Expand Down

0 comments on commit ffb7aec

Please sign in to comment.