|
127 | 127 | (m*/operator 1 (math.-/subtract 2 3))"
|
128 | 128 | (clojure--rename-ns-alias-internal "math.*" "m*"))
|
129 | 129 |
|
130 |
| - (it "should offer completions" |
| 130 | + (when-refactoring-it "should replace aliases in region" |
| 131 | + "(str/join []) |
| 132 | +
|
| 133 | +(s/with-gen #(string/includes? % \"gen/nope\") |
| 134 | + #(gen/fmap (fn [[s1 s2]] (str s1 \"hello\" s2)) |
| 135 | + (gen/tuple (gen/string-alphanumeric) (gen/string-alphanumeric)))) |
| 136 | +
|
| 137 | +(gen/different-library)" |
| 138 | + "(string/join []) |
| 139 | +
|
| 140 | +(s/with-gen #(string/includes? % \"gen/nope\") |
| 141 | + #(s.gen/fmap (fn [[s1 s2]] (str s1 \"hello\" s2)) |
| 142 | + (s.gen/tuple (s.gen/string-alphanumeric) (s.gen/string-alphanumeric)))) |
| 143 | +
|
| 144 | +(gen/different-library)" |
| 145 | + |
| 146 | + (clojure--rename-ns-alias-usages "str" "string" (point-min) 13) |
| 147 | + (clojure--rename-ns-alias-usages "gen" "s.gen" (point-min) (- (point-max) 23))) |
| 148 | + |
| 149 | + (it "should offer completions for ns forms" |
131 | 150 | (expect
|
132 |
| - (clojure-collect-ns-aliases |
133 |
| - "(ns test.ns |
| 151 | + (with-clojure-buffer |
| 152 | + "(ns test.ns |
134 | 153 | (:require [my.math.subtraction :as math.-]
|
135 | 154 | [my.math.multiplication :as math.*]
|
136 | 155 | [clojure.spec.alpha :as s]
|
137 | 156 | ;; [clojure.spec.alpha2 :as s2]
|
138 | 157 | [symbols :as abc123.-$#.%*+!@]))
|
139 | 158 |
|
140 |
| -(math.*/operator 1 (math.-/subtract 2 3))") |
141 |
| - :to-equal '("abc123.-$#.%*+!@" "s" "math.*" "math.-")))) |
| 159 | +(math.*/operator 1 (math.-/subtract 2 3))" |
| 160 | + (clojure--collect-ns-aliases (point-min) (point-max) 'ns-form)) |
| 161 | + :to-equal '("math.-" "math.*" "s" "abc123.-$#.%*+!@"))) |
| 162 | + |
| 163 | + (it "should offer completions for usages in region" |
| 164 | + (expect |
| 165 | + (with-clojure-buffer |
| 166 | + "(s/with-gen #(string/includes? % \"hello\") |
| 167 | + #(gen/fmap (fn [[s1 s2]] (str s1 \"hello\" s2)) |
| 168 | + (gen/tuple (gen/string-alphanumeric) (gen/string-alphanumeric))))" |
| 169 | + (clojure--collect-ns-aliases (point-min) (point-max) nil)) |
| 170 | + :to-equal '("s" "string" "gen")))) |
| 171 | + |
142 | 172 |
|
143 | 173 | (provide 'clojure-mode-refactor-rename-ns-alias-test)
|
144 | 174 |
|
|
0 commit comments