mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-26 23:20:29 -08:00
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.
This commit is contained in:
parent
c412d396b0
commit
9bb2fc1e64
2 changed files with 21 additions and 0 deletions
|
|
@ -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 ;;
|
||||
|
|
|
|||
|
|
@ -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. ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue