aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-10-13 21:43:01 +0200
committerAndrea Corallo2020-10-14 11:04:36 +0200
commite9c150b5c2efee4fad0e41668f5bf1ecb9fad0df (patch)
tree8d4dd30edb3b998e45010c1d9d6575e2ff6001ba /test/src
parent4f0e87903095da1225830e27ef27e61ba9ff08af (diff)
downloademacs-e9c150b5c2efee4fad0e41668f5bf1ecb9fad0df.tar.gz
emacs-e9c150b5c2efee4fad0e41668f5bf1ecb9fad0df.zip
* Add a test to verify form native compilation.
* test/src/comp-tests.el (comp-deftest): Fix typo. (compile-forms): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-tests.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 79bac3f711f..a13235b2039 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -46,7 +46,7 @@
46 "Define a test for the native compiler tagging it as :nativecomp." 46 "Define a test for the native compiler tagging it as :nativecomp."
47 (declare (indent defun) 47 (declare (indent defun)
48 (doc-string 3)) 48 (doc-string 3))
49 `(ert-deftest ,(intern (concat "compt-tests-" (symbol-name name))) ,args 49 `(ert-deftest ,(intern (concat "comp-tests-" (symbol-name name))) ,args
50 :tags '(:nativecomp) 50 :tags '(:nativecomp)
51 ,@docstring-and-body)) 51 ,@docstring-and-body))
52 52
@@ -409,6 +409,17 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
409 (should (eq (comp-test-primitive-redefine-f 10 2) 'xxx)) 409 (should (eq (comp-test-primitive-redefine-f 10 2) 'xxx))
410 (should (equal comp-test-primitive-redefine-args '(10 2))))) 410 (should (equal comp-test-primitive-redefine-args '(10 2)))))
411 411
412(comp-deftest compile-forms ()
413 "Verify lambda form native compilation."
414 (should-error (native-compile '(+ 1 foo)))
415 (let ((f (native-compile '(lambda (x) (1+ x)))))
416 (should (subr-native-elisp-p f))
417 (should (= (funcall f 2) 3)))
418 (let* ((lexical-binding nil)
419 (f (native-compile '(lambda (x) (1+ x)))))
420 (should (subr-native-elisp-p f))
421 (should (= (funcall f 2) 3))))
422
412 423
413;;;;;;;;;;;;;;;;;;;;; 424;;;;;;;;;;;;;;;;;;;;;
414;; Tromey's tests. ;; 425;; Tromey's tests. ;;