emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp e9c150b 5/7: * Add a test to verify form native comp


From: Andrea Corallo
Subject: feature/native-comp e9c150b 5/7: * Add a test to verify form native compilation.
Date: Wed, 14 Oct 2020 05:13:47 -0400 (EDT)

branch: feature/native-comp
commit e9c150b5c2efee4fad0e41668f5bf1ecb9fad0df
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * 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 79bac3f..a13235b 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. ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]