diff options
| author | Andrea Corallo | 2020-10-03 16:12:19 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-10-05 21:32:38 +0200 |
| commit | f43dbe65ce14921aee2f45d21eb5f294ec8b92c1 (patch) | |
| tree | 01b789dd0e56257c196bee2729776e31b01c8cdb /test/src | |
| parent | 87c6aa13b30281398688ec8693a0205bb84bc648 (diff) | |
| download | emacs-f43dbe65ce14921aee2f45d21eb5f294ec8b92c1.tar.gz emacs-f43dbe65ce14921aee2f45d21eb5f294ec8b92c1.zip | |
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.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-test-funcs.el | 4 | ||||
| -rw-r--r-- | test/src/comp-tests.el | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el index 19acec2716e..9285ed62c2a 100644 --- a/test/src/comp-test-funcs.el +++ b/test/src/comp-test-funcs.el | |||
| @@ -341,6 +341,10 @@ | |||
| 341 | (declare (speed 2)) | 341 | (declare (speed 2)) |
| 342 | (+ x y)) | 342 | (+ x y)) |
| 343 | 343 | ||
| 344 | (defun comp-test-primitive-redefine-f (x y) | ||
| 345 | (declare (speed 2)) | ||
| 346 | (- x y)) | ||
| 347 | |||
| 344 | 348 | ||
| 345 | ;;;;;;;;;;;;;;;;;;;; | 349 | ;;;;;;;;;;;;;;;;;;;; |
| 346 | ;; Tromey's tests ;; | 350 | ;; Tromey's tests ;; |
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index f954ae6a9dd..317a6113af2 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." | |||
| 398 | (should (equal comp-test-primitive-advice '(3 4)))) | 398 | (should (equal comp-test-primitive-advice '(3 4)))) |
| 399 | (advice-remove #'+ f)))) | 399 | (advice-remove #'+ f)))) |
| 400 | 400 | ||
| 401 | (defvar comp-test-primitive-redefine-args) | ||
| 402 | (comp-deftest primitive-redefine () | ||
| 403 | "Test effectiveness of primitve redefinition." | ||
| 404 | (cl-letf ((comp-test-primitive-redefine-args nil) | ||
| 405 | ((symbol-function #'-) | ||
| 406 | (lambda (&rest args) | ||
| 407 | (setq comp-test-primitive-redefine-args args) | ||
| 408 | 'xxx))) | ||
| 409 | (should (eq (comp-test-primitive-redefine-f 10 2) 'xxx)) | ||
| 410 | (should (equal comp-test-primitive-redefine-args '(10 2))))) | ||
| 411 | |||
| 401 | 412 | ||
| 402 | ;;;;;;;;;;;;;;;;;;;;; | 413 | ;;;;;;;;;;;;;;;;;;;;; |
| 403 | ;; Tromey's tests. ;; | 414 | ;; Tromey's tests. ;; |