summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2016-06-07 22:32:59 +0200
committerMichal Nazarewicz <mina86@mina86.com>2016-06-08 19:10:59 +0200
commit7715ee54b3588cfdef03b5d45aaf44b73b422ec6 (patch)
tree176ae2e58b9018e0b761aea2bd31e2161e6c0481 /test/lisp/emacs-lisp
parent027e6fbfe472bad1fd0464e070bc782c7e3e776a (diff)
downloademacs-7715ee54b3588cfdef03b5d45aaf44b73b422ec6.tar.gz
Remove ‘ert-with-function-mocked’ macro in favour of ‘cl-letf’ macro
* lisp/emacs-lisp/ert-x.el (ert-with-function-mocked): Remove macro in favour of ‘cl-letf’ macro which is more generic. All existing uses are migrated accordingly. The macro has not been included in an official release yet so it should be fine to delete it.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/ert-x-tests.el43
1 files changed, 0 insertions, 43 deletions
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el
index a2665e7c390..ef8642aebfb 100644
--- a/test/lisp/emacs-lisp/ert-x-tests.el
+++ b/test/lisp/emacs-lisp/ert-x-tests.el
@@ -275,49 +275,6 @@ desired effect."
(should (equal (c x) (lisp x))))))
-(defun ert--dummy-id (a)
- "Identity function. Used for tests only."
- a)
-
-(ert-deftest ert-with-function-mocked ()
- (let ((mock-id (lambda (_) 21)))
- (should (eq 42 (ert--dummy-id 42)))
-
- (ert-with-function-mocked ert--dummy-id nil
- (fset 'ert--dummy-id mock-id)
- (should (eq 21 (ert--dummy-id 42))))
- (should (eq 42 (ert--dummy-id 42)))
-
- (ert-with-function-mocked ert--dummy-id mock-id
- (should (eq 21 (ert--dummy-id 42))))
- (should (eq 42 (ert--dummy-id 42)))
-
- (should
- (catch 'exit
- (ert-with-function-mocked ert--dummy-id mock-id
- (should (eq 21 (ert--dummy-id 42))))
- (throw 'exit t)))
- (should (eq 42 (ert--dummy-id 42)))
-
- (should
- (string= "Foo"
- (condition-case err
- (progn
- (ert-with-function-mocked ert--dummy-id mock-id
- (should (eq 21 (ert--dummy-id 42))))
- (user-error "Foo"))
- (user-error (cadr err)))))
- (should (eq 42 (ert--dummy-id 42)))
-
- (should
- (string= "`ert--dummy-id' unexpectedly called."
- (condition-case err
- (ert-with-function-mocked ert--dummy-id nil
- (ert--dummy-id 42))
- (ert-test-failed (cadr err)))))
- (should (eq 42 (ert--dummy-id 42)))))
-
-
(provide 'ert-x-tests)
;;; ert-x-tests.el ends here