Skip to content

Commit 1dbcc9a

Browse files
committed
Add tests for new rename-ns-alias functionality
1 parent 03aabaa commit 1dbcc9a

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

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

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,34 @@
9595
;; TODO refactor using new-lib/foo
9696
(+ (new-lib/a 1) (b 2))"
9797

98-
(clojure--rename-ns-alias-internal "lib" "new-lib")))
99-
100-
(provide 'clojure-mode-refactor-rename-ns-alias-test)
98+
(clojure--rename-ns-alias-internal "lib" "new-lib"))
99+
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+
(expect
115+
(clojure-collect-ns-aliases
116+
"(ns test.ns
117+
(:require [my.math.subtraction :as math.-]
118+
[my.math.multiplication :as math.*]
119+
[clojure.spec.alpha :as s]
120+
;; [clojure.spec.alpha2 :as s2]
121+
[symbols :as abc123.-$#.%*+!@]))
122+
123+
(math.*/operator 1 (math.-/subtract 2 3))")
124+
:to-equal '("abc123.-$#.%*+!@" "s" "math.*" "math.-"))))
125+
126+
(provide 'clojure-mode-refactor-rename-ns-alias-test)
101127

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

0 commit comments

Comments
 (0)