File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 39
39
(clj-file-ns " my-project.my-ns.my-file" )
40
40
(clojure-cache-project nil ))
41
41
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
+
42
52
(describe " clojure-project-relative-path"
43
53
(cl-letf (((symbol-function 'clojure-project-dir ) (lambda () project-dir)))
44
54
(expect (string= (clojure-project-relative-path clj-file-path)
Original file line number Diff line number Diff line change @@ -96,5 +96,15 @@ DESCRIPTION is a string with the description of the spec."
96
96
(expect (point ) :to-equal expected-cursor-pos)))))
97
97
98
98
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
+
99
109
(provide 'test-helper )
100
110
; ;; test-helper.el ends here
You can’t perform that action at this time.
0 commit comments