Skip to content

Commit cde7fc3

Browse files
committed
Add unit test suite, disable test-checks
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).
1 parent af1bde5 commit cde7fc3

File tree

6 files changed

+34
-16
lines changed

6 files changed

+34
-16
lines changed

.circleci/config.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ default: &default-steps
1212
- run: make test
1313
# Make sure to run test-checks before test-bytecomp, as test-bytecomp autogenerates
1414
# files which won't pass test-checks.
15-
- run: make test-checks
16-
- run: make test-bytecomp
15+
# disabled - see https://github.com/clojure-emacs/clj-refactor.el/issues/491
16+
#- run: make test-checks
17+
#- run: make test-bytecomp
1718

1819
# Enumerated list of Emacs versions
1920
jobs:

Cask

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55

66
(development
77
(depends-on "ecukes")
8-
(depends-on "espuds"))
8+
(depends-on "espuds")
9+
(depends-on "buttercup"))

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PKGDIR := $(shell EMACS=$(EMACS) $(CASK) package-directory)
77
SRCS = $(wildcard *.el)
88
OBJS = $(SRCS:.el=.elc)
99

10-
.PHONY: compile test clean elpa
10+
.PHONY: compile unit-tests integration-tests test clean elpa
1111

1212
all: compile
1313

@@ -28,9 +28,14 @@ compile: elpa
2828
clean:
2929
rm -f $(OBJS)
3030

31-
test: $(PKGDIR)
31+
integration-tests: $(PKGDIR)
3232
$(CASK) exec ecukes --no-win
3333

34+
unit-tests:
35+
$(CASK) exec buttercup -L .
36+
37+
test: unit-tests integration-tests
38+
3439
test-checks:
3540
$(CASK) exec $(EMACS) --no-site-file --no-site-lisp --batch \
3641
-l test/test-checks.el ./

feature/feature.el

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(provide 'feature)

test/test-checks.el

+12-11
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
(setq checkdoc-arguments-in-order-flag nil)
1616
(setq checkdoc-verb-check-experimental-flag nil)
1717

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

21-
;; `checkdoc-file' was introduced in Emacs 25
22-
(when (fboundp 'checkdoc-file)
23-
(dolist (file files)
24-
(checkdoc-file file))
25-
(when (get-buffer "*Warnings*")
26-
(message "Failing due to checkdoc warnings...")
27-
(kill-emacs 1)))
22+
;; `checkdoc-file' was introduced in Emacs 25
23+
(when (fboundp 'checkdoc-file)
24+
(dolist (file files)
25+
(checkdoc-file file))
26+
(when (get-buffer "*Warnings*")
27+
(message "Failing due to checkdoc warnings...")
28+
(kill-emacs 1)))
2829

29-
(when (apply #'check-declare-files files)
30-
(kill-emacs 1)))
30+
(when (apply #'check-declare-files files)
31+
(kill-emacs 1))))

tests/unit-test.el

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(require 'paredit)
2+
(require 'clj-refactor)
3+
4+
;; NOTE: please remember, without an `it` block, your tests will not be run!
5+
6+
(describe "cljr--ns-name"
7+
(it "returns the ns name of its argument"
8+
(expect (cljr--ns-name "com.corp.foo") :to-equal "foo")
9+
(expect (cljr--ns-name "foo") :to-equal "foo")))

0 commit comments

Comments
 (0)