aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-11-12 23:41:04 +0100
committerAndrea Corallo2020-11-12 23:58:58 +0100
commit9bb2fc1e647bb74fd37a62c0b2f35c8eb4f8eece (patch)
tree6370a830f6926d6b0cf25f2077214b0db51da32b /test/src
parentc412d396b0e714c604b3386369b64f0c7e762fe8 (diff)
downloademacs-9bb2fc1e647bb74fd37a62c0b2f35c8eb4f8eece.tar.gz
emacs-9bb2fc1e647bb74fd37a62c0b2f35c8eb4f8eece.zip
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.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/comp-test-funcs.el16
-rw-r--r--test/src/comp-tests.el5
2 files changed, 21 insertions, 0 deletions
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 1b0f3056b98..bcf9fcb0fd1 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -354,6 +354,22 @@
354 comp-test-and-3-var 354 comp-test-and-3-var
355 2)) 355 2))
356 356
357(defun comp-test-copy-insn-f (insn)
358 ;; From `comp-copy-insn'.
359 (if (consp insn)
360 (let (result)
361 (while (consp insn)
362 (let ((newcar (car insn)))
363 (if (or (consp (car insn)) (comp-mvar-p (car insn)))
364 (setf newcar (comp-copy-insn (car insn))))
365 (push newcar result))
366 (setf insn (cdr insn)))
367 (nconc (nreverse result)
368 (if (comp-mvar-p insn) (comp-copy-insn insn) insn)))
369 (if (comp-mvar-p insn)
370 (copy-comp-mvar insn)
371 insn)))
372
357 373
358;;;;;;;;;;;;;;;;;;;; 374;;;;;;;;;;;;;;;;;;;;
359;; Tromey's tests ;; 375;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 61838c670e1..b2f83998838 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."
444 (should (= (comp-test-and-3-f t) 2)) 444 (should (= (comp-test-and-3-f t) 2))
445 (should (null (comp-test-and-3-f '(1 2))))) 445 (should (null (comp-test-and-3-f '(1 2)))))
446 446
447(comp-deftest copy-insn ()
448 (should (equal (comp-test-copy-insn-f '(1 2 3 (4 5 6)))
449 '(1 2 3 (4 5 6))))
450 (should (null (comp-test-copy-insn-f nil))))
451
447 452
448;;;;;;;;;;;;;;;;;;;;; 453;;;;;;;;;;;;;;;;;;;;;
449;; Tromey's tests. ;; 454;; Tromey's tests. ;;