[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp f43dbe6 5/7: Add a test for primitive redefinition
From: |
Andrea Corallo |
Subject: |
feature/native-comp f43dbe6 5/7: Add a test for primitive redefinition |
Date: |
Tue, 6 Oct 2020 12:37:43 -0400 (EDT) |
branch: feature/native-comp
commit f43dbe65ce14921aee2f45d21eb5f294ec8b92c1
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
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.
---
test/src/comp-test-funcs.el | 4 ++++
test/src/comp-tests.el | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 19acec2..9285ed6 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -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 ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index f954ae6..317a611 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -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. ;;
- feature/native-comp updated (3232000 -> 4a1bb46), Andrea Corallo, 2020/10/06
- feature/native-comp ad5a2bb 1/7: Revert "Add `advice-flet' macro", Andrea Corallo, 2020/10/06
- feature/native-comp f43dbe6 5/7: Add a test for primitive redefinition,
Andrea Corallo <=
- feature/native-comp 4a1bb46 7/7: * Native compiling do not target a directory with no write permission, Andrea Corallo, 2020/10/06
- feature/native-comp 0b58be4 3/7: Rename comp-subr-safe-advice -> comp-subr-trampoline-install, Andrea Corallo, 2020/10/06
- feature/native-comp b3ade4d 2/7: Revert "Use `advice-flet' in place of `cl-letf' to avoid primitive..., Andrea Corallo, 2020/10/06
- feature/native-comp 87c6aa1 4/7: Make primitive redefinition effective through trampoline synthesis, Andrea Corallo, 2020/10/06
- feature/native-comp 29f7024 6/7: * Fix a test in test/lisp/subr-tests.el, Andrea Corallo, 2020/10/06