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 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)
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments