[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 0cc1804 07/11: Add a test for primitive advicing eff
From: |
Andrea Corallo |
Subject: |
feature/native-comp 0cc1804 07/11: Add a test for primitive advicing effectiveness |
Date: |
Thu, 24 Sep 2020 04:13:18 -0400 (EDT) |
branch: feature/native-comp
commit 0cc1804d42e25e0213f8b3872cc6133c6480a5b0
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Add a test for primitive advicing effectiveness
* test/src/comp-test-funcs.el (comp-test-primitive-advice-f): New
function.
* test/src/comp-tests.el (comp-test-primitive-advice): New test.
---
test/src/comp-test-funcs.el | 4 ++++
test/src/comp-tests.el | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index fe9943a..19acec2 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -337,6 +337,10 @@
(concat head-padding (substring str from-idx idx)
tail-padding ellipsis)))))
+(defun comp-test-primitive-advice-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 220bf1c..356bd87 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -375,6 +375,19 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(should (string= (comp-test-42360-f "Nel mezzo del " 18 0 32 "yyy" nil)
"Nel mezzo del yyy")))
+(defvar comp-test-primitive-advice)
+(ert-deftest comp-test-primitive-advice ()
+ "Test effectiveness of primitve advicing."
+ (let (comp-test-primitive-advice
+ (f (lambda (&rest args)
+ (setq comp-test-primitive-advice args))))
+ (advice-add #'+ :before f)
+ (unwind-protect
+ (progn
+ (should (= (comp-test-primitive-advice-f 3 4) 7))
+ (should (equal comp-test-primitive-advice '(3 4))))
+ (advice-remove #'+ f))))
+
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;
- feature/native-comp updated (4a50f54 -> e5b052d), Andrea Corallo, 2020/09/24
- feature/native-comp 63c65b4 01/11: * lisp/emacs-lisp/comp.el (native-compile): Add OUTPUT parameter., Andrea Corallo, 2020/09/24
- feature/native-comp 2ab0966 03/11: Make CHECK_SUBR public, Andrea Corallo, 2020/09/24
- feature/native-comp 3ec1b93 05/11: * Add `comp--subr-safe-advice' entry point, Andrea Corallo, 2020/09/24
- feature/native-comp 2f78ac3 04/11: * Add `comp--install-trampoline' machinery, Andrea Corallo, 2020/09/24
- feature/native-comp 0cc1804 07/11: Add a test for primitive advicing effectiveness,
Andrea Corallo <=
- feature/native-comp b94a0a9 08/11: * lisp/emacs-lisp/comp.el (comp-never-optimize-functions): Clean-up., Andrea Corallo, 2020/09/24
- feature/native-comp 9d4fd66 02/11: * lisp/emacs-lisp/comp.el (comp-final): Log when interactively invoked., Andrea Corallo, 2020/09/24
- feature/native-comp 6d83902 10/11: * lisp/emacs-lisp/comp.el (comp-body-eff): Improve style., Andrea Corallo, 2020/09/24
- feature/native-comp 94736c4 09/11: Do not install a subr trampoline twice, Andrea Corallo, 2020/09/24
- feature/native-comp e5b052d 11/11: Rename comp--subr-safe-advice -> comp-subr-safe-advice, Andrea Corallo, 2020/09/24
- feature/native-comp db354ff 06/11: Call `comp--subr-safe-advice' from the advice machinery, Andrea Corallo, 2020/09/24