summaryrefslogtreecommitdiffstats
path: root/tests/012/oop-seq.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-06-26 01:48:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-06-26 01:48:23 -0700
commit32f6e7e1d706b22b42a0f46fbe49741491c6d9d0 (patch)
treee143098ac15a81b4f2f07fa1cb4b4f9f23feba00 /tests/012/oop-seq.tl
parent54d8de908450b105b3c63fd14ea291b52b15f4e7 (diff)
downloadtxr-32f6e7e1d706b22b42a0f46fbe49741491c6d9d0.tar.gz
txr-32f6e7e1d706b22b42a0f46fbe49741491c6d9d0.tar.bz2
txr-32f6e7e1d706b22b42a0f46fbe49741491c6d9d0.zip
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.
Diffstat (limited to 'tests/012/oop-seq.tl')
-rw-r--r--tests/012/oop-seq.tl17
1 files changed, 15 insertions, 2 deletions
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.