Skip to content

Commit 92337ac

Browse files
committed
[Docs] Add an example for cider-test-infer-test-ns
1 parent 65a3c5c commit 92337ac

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

doc/modules/ROOT/pages/testing/running_tests.adoc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,22 @@ you can set the variable `cider-test-infer-test-ns` to a function that
8888
takes the current namespace and returns the matching test namespace
8989
(which may be the same as the current namespace). This provides
9090
complete flexibility to structure your test suite using whatever
91-
conventions you might want.
91+
conventions you might want. Here's how you can configure the test running
92+
to look for `some.test-ns` instead of `some.ns-test`:
93+
94+
[source,lisp]
95+
----
96+
(defun cider-custom-test-ns-fn (ns)
97+
"For a NS, return the test namespace, which may be the argument itself.
98+
This uses the convention of prepending 'test-' to the namespace name."
99+
(when ns
100+
(let ((prefix "test-"))
101+
(if (string-prefix-p prefix ns)
102+
ns
103+
(concat prefix ns)))))
104+
105+
(setq cider-test-infer-test-ns #'cider-custom-test-ns-fn)
106+
----
92107

93108
If your individual tests are not defined by `deftest` or `defspec`, CIDER will
94109
not recognize them when searching for a test at point in `cider-test-run-test`.

0 commit comments

Comments
 (0)