Skip to content

Commit 0d5ce21

Browse files
chaosbbatsov
authored andcommitted
Nbb support
1 parent b41b92e commit 0d5ce21

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

clojure-mode-util-test.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
(clj-file-ns "my-project.my-ns.my-file")
4040
(clojure-cache-project nil))
4141

42+
(describe "clojure-project-root-path"
43+
(it "nbb subdir"
44+
(with-temp-dir temp-dir
45+
(let* ((bb-edn (expand-file-name "nbb.edn" temp-dir))
46+
(bb-edn-src (expand-file-name "src" temp-dir)))
47+
(write-region "{}" nil bb-edn)
48+
(make-directory bb-edn-src)
49+
(expect (clojure-project-dir bb-edn-src)
50+
:to-equal (file-name-as-directory temp-dir))))))
51+
4252
(describe "clojure-project-relative-path"
4353
(cl-letf (((symbol-function 'clojure-project-dir) (lambda () project-dir)))
4454
(expect (string= (clojure-project-relative-path clj-file-path)

utils/test-helper.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,15 @@ DESCRIPTION is a string with the description of the spec."
9696
(expect (point) :to-equal expected-cursor-pos)))))
9797

9898

99+
;; https://emacs.stackexchange.com/a/55031
100+
(defmacro with-temp-dir (temp-dir &rest body)
101+
"Create a temporary directory and bind its to TEMP-DIR while evaluating BODY.
102+
Removes the temp directory at the end of evaluation."
103+
`(let ((,temp-dir (make-temp-file "" t)))
104+
(unwind-protect
105+
(progn
106+
,@body)
107+
(delete-directory ,temp-dir t))))
108+
99109
(provide 'test-helper)
100110
;;; test-helper.el ends here

0 commit comments

Comments
 (0)