File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -241,6 +241,13 @@ will bring the behavior in line with the newer Emacsen."
241
241
(ivy--regex " (foo bar" ))
242
242
" (\\ (foo).*?(bar)" )))
243
243
244
+ (defmacro ivy--string-buffer (text body )
245
+ " Test helper that wraps TEXT in a temp buffer while running BODY."
246
+ `(with-temp-buffer
247
+ (insert , text )
248
+ (goto-char (point-min ))
249
+ , body ))
250
+
244
251
(ert-deftest counsel-url-expand ()
245
252
" Test ffap expansion using counsel-url-expansions."
246
253
; ; no expansions defined
@@ -252,14 +259,17 @@ will bring the behavior in line with the newer Emacsen."
252
259
(concat " https://foo.com/issues/"
253
260
(match-string 1 word)))))))
254
261
; ; no match
255
- (defun current-word () " foobar" )
256
- (should (equal (counsel-url-expand) nil ))
262
+ (ivy--string-buffer
263
+ " foobar"
264
+ (should (equal (counsel-url-expand) nil )))
257
265
; ; string expansion
258
- (defun current-word () " foo" )
259
- (should (equal (counsel-url-expand) " https://foo.com/foo" ))
266
+ (ivy--string-buffer
267
+ " foo"
268
+ (should (equal (counsel-url-expand) " https://foo.com/foo" )))
260
269
; ; function expansion
261
- (defun current-word () " issue123" )
262
- (should (equal (counsel-url-expand) " https://foo.com/issues/123" ))))
270
+ (ivy--string-buffer
271
+ " issue123"
272
+ (should (equal (counsel-url-expand) " https://foo.com/issues/123" )))))
263
273
264
274
(ert-deftest colir-color-parse ()
265
275
(should (equal (colir-color-parse " #ab1234" )
You can’t perform that action at this time.
0 commit comments