From: Andrea Corallo Date: Tue, 13 Oct 2020 19:43:01 +0000 (+0200) Subject: * Add a test to verify form native compilation. X-Git-Tag: emacs-28.0.90~2727^2~366 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e9c150b5c2efee4fad0e41668f5bf1ecb9fad0df;p=emacs.git * Add a test to verify form native compilation. * test/src/comp-tests.el (comp-deftest): Fix typo. (compile-forms): New test. --- 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. ;;