diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-03-24 06:27:15 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-03-24 06:27:15 -0700 |
commit | 3e7368db7c823e747c791d9857a5e1f810b9afba (patch) | |
tree | e3ad5cec0a9978773730fd70f6f4037aef27aa57 /tests/012 | |
parent | 3f089edac96f9c0f37aa36b3ed3bc2ecc9b85ffa (diff) | |
download | txr-3e7368db7c823e747c791d9857a5e1f810b9afba.tar.gz txr-3e7368db7c823e747c791d9857a5e1f810b9afba.tar.bz2 txr-3e7368db7c823e747c791d9857a5e1f810b9afba.zip |
Some basic tests for finalization.
* tests/012/fini.tl: New file.
* tests/012/fini.expected: New file.
Diffstat (limited to 'tests/012')
-rw-r--r-- | tests/012/fini.expected | 83 | ||||
-rw-r--r-- | tests/012/fini.tl | 22 |
2 files changed, 105 insertions, 0 deletions
diff --git a/tests/012/fini.expected b/tests/012/fini.expected new file mode 100644 index 00000000..5e967eb2 --- /dev/null +++ b/tests/012/fini.expected @@ -0,0 +1,83 @@ +inside with-objects +base:21 finalized +derived:1 derived fini +derived:1 finalized +derived:2 derived fini +derived:2 finalized +derived:3 derived fini +derived:3 finalized +derived:4 derived fini +derived:4 finalized +derived:5 derived fini +derived:5 finalized +derived:6 derived fini +derived:6 finalized +derived:7 derived fini +derived:7 finalized +derived:8 derived fini +derived:8 finalized +derived:9 derived fini +derived:9 finalized +derived:10 derived fini +derived:10 finalized +derived:11 derived fini +derived:11 finalized +derived:12 derived fini +derived:12 finalized +derived:13 derived fini +derived:13 finalized +derived:14 derived fini +derived:14 finalized +derived:15 derived fini +derived:15 finalized +derived:16 derived fini +derived:16 finalized +derived:17 derived fini +derived:17 finalized +derived:18 derived fini +derived:18 finalized +derived:19 derived fini +derived:19 finalized +derived:20 derived fini +derived:20 finalized +after with-objects +derived:41 derived fini +derived:41 finalized +derived:40 derived fini +derived:40 finalized +derived:39 derived fini +derived:39 finalized +derived:38 derived fini +derived:38 finalized +derived:37 derived fini +derived:37 finalized +derived:36 derived fini +derived:36 finalized +derived:35 derived fini +derived:35 finalized +derived:34 derived fini +derived:34 finalized +derived:33 derived fini +derived:33 finalized +derived:32 derived fini +derived:32 finalized +derived:31 derived fini +derived:31 finalized +derived:30 derived fini +derived:30 finalized +derived:29 derived fini +derived:29 finalized +derived:28 derived fini +derived:28 finalized +derived:27 derived fini +derived:27 finalized +derived:26 derived fini +derived:26 finalized +derived:25 derived fini +derived:25 finalized +derived:24 derived fini +derived:24 finalized +derived:23 derived fini +derived:23 finalized +derived:22 derived fini +derived:22 finalized diff --git a/tests/012/fini.tl b/tests/012/fini.tl new file mode 100644 index 00000000..3aa581f9 --- /dev/null +++ b/tests/012/fini.tl @@ -0,0 +1,22 @@ +(load "../common") + +(defstruct base nil + others + id + (:static counter 0) + (:postinit (me) (set me.id (inc me.counter))) + (:fini (me) + (put-line `@(typeof me):@{me.id} finalized`) + [mapdo call-finalizers me.others])) + +(defstruct derived base + (:fini (me) + (put-line `@(typeof me):@{me.id} derived fini`))) + +(unwind-protect + (with-objects ((b (new base others (mapcar (ret (new derived)) (range 1 20))))) + (put-line "inside with-objects")) + (put-line "after with-objects")) + +(mapcar (ret (new derived)) (range 1 20)) +(sys:gc) |