From 32f6e7e1d706b22b42a0f46fbe49741491c6d9d0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 26 Jun 2024 01:48:23 -0700 Subject: copy-iter: some tests. * test/012/oop-seq.tl: Add tests that verify that an OOP iter without a copy method cannot be copied with copy-iter, and that one which has the method can be copied, in accordance with the requirements. --- tests/012/oop-seq.tl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests/012/oop-seq.tl') diff --git a/tests/012/oop-seq.tl b/tests/012/oop-seq.tl index 17463e96..3bdd5ae7 100644 --- a/tests/012/oop-seq.tl +++ b/tests/012/oop-seq.tl @@ -68,9 +68,22 @@ (let ((ints (new integers item 1 to 10))) (mtest - (length-< ints 11) t) + (length-< ints 11) t (length-< ints 10) nil - (length-< ints 9) nil) + (length-< ints 9) nil)) + +(test + (copy-iter (new counter-iter-fast)) :error) + +(defstruct copyable-iter () + (stamp 0) + (:method copy (me) + (new copyable-iter stamp (succ me.stamp)))) + +(let* ((c0 (new copyable-iter stamp 42)) + (c1 (copy-iter c0))) + (vtest c0.stamp 42) + (vtest c1.stamp 43)) ;; The following reproduced a segfault when the change was made to allow del to ;; work with structs that have lambda and lambda-set. -- cgit v1.2.3