* test/src/comp-tests.el (primitive-redefine): New test.
* test/src/comp-test-funcs.el (comp-test-primitive-redefine-f):
New function.
(declare (speed 2))
(+ x y))
+(defun comp-test-primitive-redefine-f (x y)
+ (declare (speed 2))
+ (- x y))
+
\f
;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests ;;
(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)))))
+
\f
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;