Add a test for primitive redefinition
* test/src/comp-tests.el (primitive-redefine): New test. * test/src/comp-test-funcs.el (comp-test-primitive-redefine-f): New function.
This commit is contained in:
parent
87c6aa13b3
commit
f43dbe65ce
2 changed files with 15 additions and 0 deletions
|
@ -341,6 +341,10 @@
|
|||
(declare (speed 2))
|
||||
(+ x y))
|
||||
|
||||
(defun comp-test-primitive-redefine-f (x y)
|
||||
(declare (speed 2))
|
||||
(- x y))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;
|
||||
;; Tromey's tests ;;
|
||||
|
|
|
@ -398,6 +398,17 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
|
|||
(should (equal comp-test-primitive-advice '(3 4))))
|
||||
(advice-remove #'+ f))))
|
||||
|
||||
(defvar comp-test-primitive-redefine-args)
|
||||
(comp-deftest primitive-redefine ()
|
||||
"Test effectiveness of primitve redefinition."
|
||||
(cl-letf ((comp-test-primitive-redefine-args nil)
|
||||
((symbol-function #'-)
|
||||
(lambda (&rest args)
|
||||
(setq comp-test-primitive-redefine-args args)
|
||||
'xxx)))
|
||||
(should (eq (comp-test-primitive-redefine-f 10 2) 'xxx))
|
||||
(should (equal comp-test-primitive-redefine-args '(10 2)))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Tromey's tests. ;;
|
||||
|
|
Loading…
Add table
Reference in a new issue