Skip to content

Commit e9e9448

Browse files
author
Jinseop Kim
committed
Fix for error in clojure-expected-ns
When call `clojure-expected-ns` function without arguments, error occured.
1 parent 1fde668 commit e9e9448

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

clojure-mode.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ nil."
997997
PATH is expected to be an absolute file path.
998998
999999
If PATH is nil, use the path to the file backing the current buffer."
1000-
(let* ((relative (clojure-project-relative-path
1001-
(or path (file-truename (buffer-file-name)))))
1000+
(let* ((path (or path (file-truename (buffer-file-name))))
1001+
(relative (clojure-project-relative-path path))
10021002
(sans-file-type (substring relative 0 (- (length (file-name-extension path t)))))
10031003
(sans-file-sep (mapconcat 'identity (cdr (split-string sans-file-type "/")) "."))
10041004
(sans-underscores (replace-regexp-in-string "_" "-" sans-file-sep)))

test/clojure-mode-util-test.el

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@
4242
(cl-letf (((symbol-function 'clojure-project-relative-path)
4343
(lambda (&optional current-buffer-file-name)
4444
project-relative-clj-file-path)))
45-
(should (string= (clojure-expected-ns clj-file-path) clj-file-ns)))))
45+
(should (string= (clojure-expected-ns clj-file-path) clj-file-ns))))
46+
47+
(ert-deftest expected-ns-without-argument ()
48+
:tags '(utils)
49+
(cl-letf (((symbol-function 'clojure-project-relative-path)
50+
(lambda (&optional current-buffer-file-name)
51+
project-relative-clj-file-path)))
52+
(should (string= (let ((buffer-file-name clj-file-path))
53+
(clojure-expected-ns))
54+
clj-file-ns)))))
4655

4756
(provide 'clojure-mode-util-test)
4857

0 commit comments

Comments
 (0)