Skip to content

Commit 4f9548a

Browse files
committed
Add tests for new rename-ns-alias functionality
1 parent 66f1c8c commit 4f9548a

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

test/clojure-mode-refactor-rename-ns-alias-test.el

+25-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,31 @@
9595
;; TODO refactor using new-lib/foo
9696
(+ (new-lib/a 1) (b 2))"
9797

98-
(clojure--rename-ns-alias-internal "lib" "new-lib")))
98+
(clojure--rename-ns-alias-internal "lib" "new-lib"))
9999

100-
(provide 'clojure-mode-refactor-rename-ns-alias-test)
100+
(when-refactoring-it "should escape regex characters"
101+
"(ns test.ns
102+
(:require [my.math.subtraction :as math.-]
103+
[my.math.multiplication :as math.*]))
104+
105+
(math.*/operator 1 (math.-/subtract 2 3))"
106+
"(ns test.ns
107+
(:require [my.math.subtraction :as math.-]
108+
[my.math.multiplication :as m*]))
109+
110+
(m*/operator 1 (math.-/subtract 2 3))"
111+
(clojure--rename-ns-alias-internal "math.*" "m*"))
112+
113+
(it "should offer completions"
114+
(with-clojure-buffer
115+
"(ns test.ns
116+
(:require [my.math.subtraction :as math.-]
117+
[my.math.multiplication :as math.*]))
118+
119+
(math.*/operator 1 (math.-/subtract 2 3))"
120+
(expect (clojure--collect-ns-aliases)
121+
:to-equal '((104 . "math.*") (56 . "math.-"))))))
122+
123+
(provide 'clojure-mode-refactor-rename-ns-alias-test)
101124

102125
;;; clojure-mode-refactor-rename-ns-alias-test.el ends here

0 commit comments

Comments
 (0)