[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 00be21c 36/40: Change cl dep to cl-lib for tests too
From: |
Noam Postavsky |
Subject: |
[elpa] master 00be21c 36/40: Change cl dep to cl-lib for tests too |
Date: |
Wed, 26 Oct 2016 23:06:34 +0000 (UTC) |
branch: master
commit 00be21c7170da3ac1f06e83ed36e3446af5525f9
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Change cl dep to cl-lib for tests too
* yasnippet-tests.el (yas--call-with-temporary-redefinitions):
(yas-with-overriden-buffer-list):
(snippet-save, test-yas-define-menu, test-group-menus):
(test-group-menus-twisted, yas-call-with-saving-variables): Replace cl
function with cl-lib named equivalents.
---
yasnippet-tests.el | 91 ++++++++++++++++++++++++++--------------------------
1 file changed, 45 insertions(+), 46 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 48d20fa..1dc2374 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -27,7 +27,7 @@
(require 'yasnippet)
(require 'ert)
(require 'ert-x)
-(require 'cl)
+(require 'cl-lib)
;;; Snippet mechanics
@@ -528,19 +528,19 @@ TODO: correct this bug!"
;;;
(defun yas--call-with-temporary-redefinitions (function
&rest
function-names-and-overriding-functions)
- (let* ((overrides (remove-if-not #'(lambda (fdef)
- (fboundp (first fdef)))
- function-names-and-overriding-functions))
- (definition-names (mapcar #'first overrides))
- (overriding-functions (mapcar #'second overrides))
+ (let* ((overrides (cl-remove-if-not (lambda (fdef)
+ (fboundp (car fdef)))
+ function-names-and-overriding-functions))
+ (definition-names (mapcar #'car overrides))
+ (overriding-functions (mapcar #'cl-second overrides))
(saved-functions (mapcar #'symbol-function definition-names)))
;; saving all definitions before overriding anything ensures FDEFINITION
;; errors don't cause accidental permanent redefinitions.
;;
(cl-labels ((set-fdefinitions (names functions)
- (loop for name in names
- for fn in functions
- do (fset name fn))))
+ (cl-loop for name in names
+ for fn in functions
+ do (fset name fn))))
(set-fdefinitions definition-names overriding-functions)
(unwind-protect (funcall function)
(set-fdefinitions definition-names saved-functions)))))
@@ -555,8 +555,8 @@ TODO: correct this bug!"
`(yas--call-with-temporary-redefinitions
(lambda () ,@body)
,@(mapcar #'(lambda (thingy)
- `(list ',(first thingy)
- (lambda ,@(rest thingy))))
+ `(list ',(car thingy)
+ (lambda ,@(cdr thingy))))
fdefinitions)))
(defmacro yas-with-overriden-buffer-list (&rest body)
@@ -564,10 +564,10 @@ TODO: correct this bug!"
`(let ((,saved-sym (symbol-function 'buffer-list)))
(yas--with-temporary-redefinitions
((buffer-list ()
- (remove-if #'(lambda (buf)
- (with-current-buffer buf
- (eq major-mode
'lisp-interaction-mode)))
- (funcall ,saved-sym))))
+ (cl-remove-if (lambda (buf)
+ (with-current-buffer buf
+ (eq major-mode
'lisp-interaction-mode)))
+ (funcall ,saved-sym))))
,@body))))
@@ -640,13 +640,13 @@ TODO: correct this bug!"
(yas-with-snippet-dirs
'((".emacs.d/snippets"
("text-mode")))
- (letf (((symbol-function 'y-or-n-p) (lambda (&rest _) t))
- ((symbol-function 'read-file-name)
- (lambda (_prompt &optional _dir _default _mustmatch initial
_predicate)
- (expand-file-name initial)))
- ((symbol-function 'completing-read)
- (lambda (_prompt collection &rest _)
- (or (car collection) ""))))
+ (cl-letf (((symbol-function 'y-or-n-p) (lambda (&rest _) t))
+ ((symbol-function 'read-file-name)
+ (lambda (_prompt &optional _dir _default _mustmatch initial
_predicate)
+ (expand-file-name initial)))
+ ((symbol-function 'completing-read)
+ (lambda (_prompt collection &rest _)
+ (or (car collection) ""))))
(with-temp-buffer
(text-mode)
(yas-minor-mode +1)
@@ -840,12 +840,12 @@ TODO: correct this bug!"
(let ((menu (cdr (gethash 'fancy-mode yas--menu-table))))
(should (eql 4 (length menu)))
(dolist (item '("a-guy" "a-beggar"))
- (should (find item menu :key #'third :test #'string=)))
- (should-not (find "an-outcast" menu :key #'third :test #'string=))
+ (should (cl-find item menu :key #'cl-third :test #'string=)))
+ (should-not (cl-find "an-outcast" menu :key #'cl-third :test #'string=))
(dolist (submenu '("sirs" "ladies"))
(should (keymapp
- (fourth
- (find submenu menu :key #'third :test #'string=)))))
+ (cl-fourth
+ (cl-find submenu menu :key #'cl-third :test #'string=)))))
))))
(ert-deftest test-group-menus ()
@@ -858,19 +858,19 @@ TODO: correct this bug!"
(let ((menu (cdr (gethash 'c-mode yas--menu-table))))
(should (eql 3 (length menu)))
(dolist (item '("printf" "foo-group-a" "foo-group-b"))
- (should (find item menu :key #'third :test #'string=)))
+ (should (cl-find item menu :key #'cl-third :test #'string=)))
(dolist (submenu '("foo-group-a" "foo-group-b"))
(should (keymapp
- (fourth
- (find submenu menu :key #'third :test #'string=))))))
+ (cl-fourth
+ (cl-find submenu menu :key #'cl-third :test #'string=))))))
;; now group directives
;;
(let ((menu (cdr (gethash 'lisp-interaction-mode yas--menu-table))))
(should (eql 1 (length menu)))
- (should (find "barbar" menu :key #'third :test #'string=))
+ (should (cl-find "barbar" menu :key #'cl-third :test #'string=))
(should (keymapp
- (fourth
- (find "barbar" menu :key #'third :test #'string=))))))))
+ (cl-fourth
+ (cl-find "barbar" menu :key #'cl-third :test #'string=))))))))
(ert-deftest test-group-menus-twisted ()
"Same as similarly named test, but be mean.
@@ -882,20 +882,20 @@ TODO: be meaner"
;; behaviour
(with-temp-buffer
(insert "# group: foo-group-c\n# --\nstrecmp($1)")
- (write-region nil nil (concat (first (yas-snippet-dirs))
+ (write-region nil nil (concat (car (yas-snippet-dirs))
"/c-mode/foo-group-b/strcmp")))
(yas-reload-all 'no-jit)
(let ((menu (cdr (gethash 'c-mode yas--menu-table))))
(should (eql 4 (length menu)))
(dolist (item '("printf" "foo-group-a" "foo-group-b" "foo-group-c"))
- (should (find item menu :key #'third :test #'string=)))
+ (should (cl-find item menu :key #'cl-third :test #'string=)))
(dolist (submenu '("foo-group-a" "foo-group-b" "foo-group-c"))
(should (keymapp
- (fourth
- (find submenu menu :key #'third :test #'string=))))))
+ (cl-fourth
+ (cl-find submenu menu :key #'cl-third :test #'string=))))))
;; delete the .yas-make-groups file and watch behaviour
;;
- (delete-file (concat (first (yas-snippet-dirs))
+ (delete-file (concat (car (yas-snippet-dirs))
"/c-mode/.yas-make-groups"))
(yas-reload-all 'no-jit)
(let ((menu (cdr (gethash 'c-mode yas--menu-table))))
@@ -903,19 +903,19 @@ TODO: be meaner"
;; Change a group directive and reload
;;
(let ((menu (cdr (gethash 'lisp-interaction-mode yas--menu-table))))
- (should (find "barbar" menu :key #'third :test #'string=)))
+ (should (cl-find "barbar" menu :key #'cl-third :test #'string=)))
(with-temp-buffer
(insert "# group: foofoo\n# --\n(ert-deftest ${1:name} () $0)")
- (write-region nil nil (concat (first (yas-snippet-dirs))
+ (write-region nil nil (concat (car (yas-snippet-dirs))
"/lisp-interaction-mode/ert-deftest")))
(yas-reload-all 'no-jit)
(let ((menu (cdr (gethash 'lisp-interaction-mode yas--menu-table))))
(should (eql 1 (length menu)))
- (should (find "foofoo" menu :key #'third :test #'string=))
+ (should (cl-find "foofoo" menu :key #'cl-third :test #'string=))
(should (keymapp
- (fourth
- (find "foofoo" menu :key #'third :test #'string=))))))))
+ (cl-fourth
+ (cl-find "foofoo" menu :key #'cl-third :test #'string=))))))))
;;; The infamous and problematic tab keybinding
@@ -1045,9 +1045,9 @@ add the snippets associated with the given mode."
(saved-values (mapcar #'symbol-value vars)))
(unwind-protect
(funcall fn)
- (loop for var in vars
- for saved in saved-values
- do (set var saved)))))
+ (cl-loop for var in vars
+ for saved in saved-values
+ do (set var saved)))))
(defun yas-call-with-snippet-dirs (dirs fn)
(let* ((default-directory (make-temp-file "yasnippet-fixture" t))
@@ -1098,6 +1098,5 @@ attention to case differences."
(provide 'yasnippet-tests)
;; Local Variables:
;; indent-tabs-mode: nil
-;; byte-compile-warnings: (not cl-functions)
;; End:
;;; yasnippet-tests.el ends here
- [elpa] master 7661dc1 19/40: yasnippet.el (yas-escape-text): No error on nil text, (continued)
- [elpa] master 7661dc1 19/40: yasnippet.el (yas-escape-text): No error on nil text, Noam Postavsky, 2016/10/26
- [elpa] master 351c1e3 10/40: Don't indent first line of mirrors, Noam Postavsky, 2016/10/26
- [elpa] master 655bda8 07/40: Merge: restore backquote evaluation behaviour, Noam Postavsky, 2016/10/26
- [elpa] master 8907fd1 14/40: Escape yas-selected-text for new snippet., Noam Postavsky, 2016/10/26
- [elpa] master a4fafc3 16/40: Add test for loading snippet with same uuid, Noam Postavsky, 2016/10/26
- [elpa] master 8ca8c7d 13/40: Merge: a different fix for #712., Noam Postavsky, 2016/10/26
- [elpa] master 85a43ad 35/40: Explain about backquote expressions in doc, Noam Postavsky, 2016/10/26
- [elpa] master 3129040 24/40: Load snippet after saving, Noam Postavsky, 2016/10/26
- [elpa] master 1532e66 33/40: Fix saving of new snippets, Noam Postavsky, 2016/10/26
- [elpa] master 0ee86a2 23/40: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 00be21c 36/40: Change cl dep to cl-lib for tests too,
Noam Postavsky <=
- [elpa] master 9c9952c 12/40: Add test for indentation of single line mirrors, Noam Postavsky, 2016/10/26
- [elpa] master 4296a86 15/40: yasnippet.el (yas--quote-string): Remove., Noam Postavsky, 2016/10/26
- [elpa] master d4da806 17/40: Fix removal of snippets by uuid, Noam Postavsky, 2016/10/26
- [elpa] master 42b0c26 18/40: Don't warn about modifications to other buffers, Noam Postavsky, 2016/10/26
- [elpa] master eaaec30 38/40: Replace all occurances of `capitaomorte', Noam Postavsky, 2016/10/26
- [elpa] master ff6f31e 37/40: Replace yas--with-temp-redefs with cl-letf, Noam Postavsky, 2016/10/26
- [elpa] master 244cdfa 26/40: Merge: Simplify `yas-new-snippet' load&save logic, Noam Postavsky, 2016/10/26
- [elpa] master 9500b00 21/40: Fix field navigation in the backwards direction, Noam Postavsky, 2016/10/26
- [elpa] master 309fe15 31/40: * Rakefile: Handle unset `warnings' parameter, Noam Postavsky, 2016/10/26
- [elpa] master 9cf9208 32/40: Fix test-rebindings, Noam Postavsky, 2016/10/26