Skip to content

Commit

Permalink
Add unit test suite, disable test-checks
Browse files Browse the repository at this point in the history
Reflects the decisions we made over #493.

Code has been copied as is, except for the unit tests in question, which are for `cljr--ns-name` (as a random example that I picked).
  • Loading branch information
vemv committed Nov 17, 2021
1 parent af1bde5 commit 218463b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ default: &default-steps
- run: make elpa
- run: emacs --version
- run: cask --version
- run: make unit
- run: make test
# Make sure to run test-checks before test-bytecomp, as test-bytecomp autogenerates
# files which won't pass test-checks.
- run: make test-checks
- run: make test-bytecomp
# disabled - see https://github.com/clojure-emacs/clj-refactor.el/issues/491
#- run: make test-checks
#- run: make test-bytecomp

# Enumerated list of Emacs versions
jobs:
Expand Down
3 changes: 2 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

(development
(depends-on "ecukes")
(depends-on "espuds"))
(depends-on "espuds")
(depends-on "buttercup"))
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ clean:
test: $(PKGDIR)
$(CASK) exec ecukes --no-win

unit:
$(CASK) exec buttercup -L .

test-checks:
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
-l test/test-checks.el ./
Expand Down
1 change: 1 addition & 0 deletions feature/feature.el
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(provide 'feature)
23 changes: 12 additions & 11 deletions test/test-checks.el
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
(setq checkdoc-arguments-in-order-flag nil)
(setq checkdoc-verb-check-experimental-flag nil)

(let ((files (directory-files default-directory t
"\\`[^.].*\\.el\\'" t)))
(when nil ;; See https://github.com/clojure-emacs/clj-refactor.el/issues/491
(let ((files (directory-files default-directory t
"\\`[^.].*\\.el\\'" t)))

;; `checkdoc-file' was introduced in Emacs 25
(when (fboundp 'checkdoc-file)
(dolist (file files)
(checkdoc-file file))
(when (get-buffer "*Warnings*")
(message "Failing due to checkdoc warnings...")
(kill-emacs 1)))
;; `checkdoc-file' was introduced in Emacs 25
(when (fboundp 'checkdoc-file)
(dolist (file files)
(checkdoc-file file))
(when (get-buffer "*Warnings*")
(message "Failing due to checkdoc warnings...")
(kill-emacs 1)))

(when (apply #'check-declare-files files)
(kill-emacs 1)))
(when (apply #'check-declare-files files)
(kill-emacs 1))))
6 changes: 6 additions & 0 deletions tests/unit-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(require 'paredit)
(require 'clj-refactor)

(describe "cljr--ns-name"
(expect (cljr--ns-name "com.corp.foo") :to-be "foo")
(expect (cljr--ns-name "foo") :to-be "foo"))

0 comments on commit 218463b

Please sign in to comment.