From e9c150b5c2efee4fad0e41668f5bf1ecb9fad0df Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 13 Oct 2020 21:43:01 +0200 Subject: [PATCH] * Add a test to verify form native compilation. * test/src/comp-tests.el (comp-deftest): Fix typo. (compile-forms): New test. --- test/src/comp-tests.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 @@ "Define a test for the native compiler tagging it as :nativecomp." (declare (indent defun) (doc-string 3)) - `(ert-deftest ,(intern (concat "compt-tests-" (symbol-name name))) ,args + `(ert-deftest ,(intern (concat "comp-tests-" (symbol-name name))) ,args :tags '(:nativecomp) ,@docstring-and-body)) @@ -409,6 +409,17 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html." (should (eq (comp-test-primitive-redefine-f 10 2) 'xxx)) (should (equal comp-test-primitive-redefine-args '(10 2))))) +(comp-deftest compile-forms () + "Verify lambda form native compilation." + (should-error (native-compile '(+ 1 foo))) + (let ((f (native-compile '(lambda (x) (1+ x))))) + (should (subr-native-elisp-p f)) + (should (= (funcall f 2) 3))) + (let* ((lexical-binding nil) + (f (native-compile '(lambda (x) (1+ x))))) + (should (subr-native-elisp-p f)) + (should (= (funcall f 2) 3)))) + ;;;;;;;;;;;;;;;;;;;;; ;; Tromey's tests. ;; -- 2.39.5