File tree Expand file tree Collapse file tree 1 file changed +196
-0
lines changed Expand file tree Collapse file tree 1 file changed +196
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,202 @@ DESCRIPTION is a string with the description of the spec."
149
149
([arg]
150
150
body))"
151
151
152
+ (clojure-add-arity))
153
+
154
+ (when-refactoring-with-point-it " should handle a single-arity fn"
155
+ " (fn foo [arg]
156
+ body|)"
157
+
158
+ " (fn foo
159
+ ([|])
160
+ ([arg]
161
+ body))"
162
+
163
+ (clojure-add-arity))
164
+
165
+ (when-refactoring-with-point-it " should handle a multi-arity fn"
166
+ " (fn foo
167
+ ([x y]
168
+ body)
169
+ ([a|rg]
170
+ body))"
171
+
172
+ " (fn foo
173
+ ([|])
174
+ ([x y]
175
+ body)
176
+ ([arg]
177
+ body))"
178
+
179
+ (clojure-add-arity))
180
+
181
+ (when-refactoring-with-point-it " should handle a single-arity defmacro"
182
+ " (defmacro foo [arg]
183
+ body|)"
184
+
185
+ " (defmacro foo
186
+ ([|])
187
+ ([arg]
188
+ body))"
189
+
190
+ (clojure-add-arity))
191
+
192
+ (when-refactoring-with-point-it " should handle a multi-arity defmacro"
193
+ " (defmacro foo
194
+ ([x y]
195
+ body)
196
+ ([a|rg]
197
+ body))"
198
+
199
+ " (defmacro foo
200
+ ([|])
201
+ ([x y]
202
+ body)
203
+ ([arg]
204
+ body))"
205
+
206
+ (clojure-add-arity))
207
+
208
+ (when-refactoring-with-point-it " should handle a single-arity defmethod"
209
+ " (defmethod foo :bar [arg]
210
+ body|)"
211
+
212
+ " (defmethod foo :bar
213
+ ([|])
214
+ ([arg]
215
+ body))"
216
+
217
+ (clojure-add-arity))
218
+
219
+ (when-refactoring-with-point-it " should handle a multi-arity defmethod"
220
+ " (defmethod foo :bar
221
+ ([x y]
222
+ body)
223
+ ([a|rg]
224
+ body))"
225
+
226
+ " (defmethod foo :bar
227
+ ([|])
228
+ ([x y]
229
+ body)
230
+ ([arg]
231
+ body))"
232
+
233
+ (clojure-add-arity))
234
+
235
+ (when-refactoring-with-point-it " should handle a defn inside a reader conditional"
236
+ " #?(:clj
237
+ (defn foo
238
+ \" some docstring\"
239
+ ^{:bla \" meta\" }
240
+ |([arg]
241
+ body)))"
242
+
243
+ " #?(:clj
244
+ (defn foo
245
+ \" some docstring\"
246
+ ^{:bla \" meta\" }
247
+ ([|])
248
+ ([arg]
249
+ body)))"
250
+
251
+ (clojure-add-arity))
252
+
253
+ (when-refactoring-with-point-it " should handle a defn inside a reader conditional with 2 platform tags"
254
+ " #?(:clj
255
+ (defn foo
256
+ \" some docstring\"
257
+ ^{:bla \" meta\" }
258
+ |([arg]
259
+ body))
260
+ :cljs
261
+ (defn foo
262
+ \" some docstring\"
263
+ ^{:bla \" meta\" }
264
+ ([arg]
265
+ body)))"
266
+
267
+ " #?(:clj
268
+ (defn foo
269
+ \" some docstring\"
270
+ ^{:bla \" meta\" }
271
+ ([|])
272
+ ([arg]
273
+ body))
274
+ :cljs
275
+ (defn foo
276
+ \" some docstring\"
277
+ ^{:bla \" meta\" }
278
+ ([arg]
279
+ body)))"
280
+
281
+ (clojure-add-arity))
282
+
283
+ (when-refactoring-with-point-it " should handle a single-arity fn inside a letfn"
284
+ " (letfn [(foo [x]
285
+ bo|dy)]
286
+ (foo 3))"
287
+
288
+ " (letfn [(foo
289
+ ([|])
290
+ ([x]
291
+ body))]
292
+ (foo 3))"
293
+
294
+ (clojure-add-arity))
295
+
296
+ (when-refactoring-with-point-it " should handle a multi-arity fn inside a letfn"
297
+ " (letfn [(foo
298
+ ([x]
299
+ body)
300
+ |([x y]
301
+ body))]
302
+ (foo 3))"
303
+
304
+ " (letfn [(foo
305
+ ([|])
306
+ ([x]
307
+ body)
308
+ ([x y]
309
+ body))]
310
+ (foo 3))"
311
+
312
+ (clojure-add-arity))
313
+
314
+ (when-refactoring-with-point-it " should handle a proxy"
315
+ " (proxy [Foo] []
316
+ (bar [arg]
317
+ body|))"
318
+
319
+ " (proxy [Foo] []
320
+ (bar
321
+ ([|])
322
+ ([arg]
323
+ body)))"
324
+
325
+ (clojure-add-arity))
326
+
327
+ (when-refactoring-with-point-it " should handle a defprotocol"
328
+ " (defprotocol Foo
329
+ \" some docstring\"
330
+ (bar [arg] [x |y] \" some docstring\" ))"
331
+
332
+ " (defprotocol Foo
333
+ \" some docstring\"
334
+ (bar [|] [arg] [x y] \" some docstring\" ))"
335
+
336
+ (clojure-add-arity))
337
+
338
+ (when-refactoring-with-point-it " should handle a reify"
339
+ " (reify Foo
340
+ (bar [arg] body)
341
+ (blahs [arg]| body))"
342
+
343
+ " (reify Foo
344
+ (bar [arg] body)
345
+ (blahs [|])
346
+ (blahs [arg] body))"
347
+
152
348
(clojure-add-arity)))
153
349
154
350
(provide 'clojure-mode-refactor-add-arity-test )
You can’t perform that action at this time.
0 commit comments