[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 9bb2fc1 6/6: Add copy insn testcase
From: |
Andrea Corallo |
Subject: |
feature/native-comp 9bb2fc1 6/6: Add copy insn testcase |
Date: |
Thu, 12 Nov 2020 18:11:57 -0500 (EST) |
branch: feature/native-comp
commit 9bb2fc1e647bb74fd37a62c0b2f35c8eb4f8eece
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Add copy insn testcase
* test/src/comp-tests.el (copy-insn): New testcase.
* test/src/comp-test-funcs.el (comp-test-copy-insn-f): New
function.
---
test/src/comp-test-funcs.el | 16 ++++++++++++++++
test/src/comp-tests.el | 5 +++++
2 files changed, 21 insertions(+)
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 1b0f305..bcf9fcb 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -354,6 +354,22 @@
comp-test-and-3-var
2))
+(defun comp-test-copy-insn-f (insn)
+ ;; From `comp-copy-insn'.
+ (if (consp insn)
+ (let (result)
+ (while (consp insn)
+ (let ((newcar (car insn)))
+ (if (or (consp (car insn)) (comp-mvar-p (car insn)))
+ (setf newcar (comp-copy-insn (car insn))))
+ (push newcar result))
+ (setf insn (cdr insn)))
+ (nconc (nreverse result)
+ (if (comp-mvar-p insn) (comp-copy-insn insn) insn)))
+ (if (comp-mvar-p insn)
+ (copy-comp-mvar insn)
+ insn)))
+
;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 61838c6..b2f8399 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -444,6 +444,11 @@
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(should (= (comp-test-and-3-f t) 2))
(should (null (comp-test-and-3-f '(1 2)))))
+(comp-deftest copy-insn ()
+ (should (equal (comp-test-copy-insn-f '(1 2 3 (4 5 6)))
+ '(1 2 3 (4 5 6))))
+ (should (null (comp-test-copy-insn-f nil))))
+
;;;;;;;;;;;;;;;;;;;;;
;; Tromey's tests. ;;
- feature/native-comp updated (2435c10 -> 9bb2fc1), Andrea Corallo, 2020/11/12
- feature/native-comp 6f10e0f 2/6: * Rework `comp-ret-type-spec' in terms of `comp-phi', Andrea Corallo, 2020/11/12
- feature/native-comp c3daee7 3/6: * Add few more type specifier tests, Andrea Corallo, 2020/11/12
- feature/native-comp c4749ce 1/6: * Move phi function code into dedicated function and improve it, Andrea Corallo, 2020/11/12
- feature/native-comp 9bb2fc1 6/6: Add copy insn testcase,
Andrea Corallo <=
- feature/native-comp c412d39 5/6: * lisp/emacs-lisp/comp.el (comp-mvar-value-vld-p): Fix logic., Andrea Corallo, 2020/11/12
- feature/native-comp a37cc95 4/6: * Memoize `comp-common-supertype', Andrea Corallo, 2020/11/12