| 1 | module scheme |
| 2 | |
| 3 | import arena |
| 4 | |
| 5 | // Keep this cold-cache check in its own executable. |
| 6 | fn testsuite_begin() { |
| 7 | assert isnil(goops_protocol_cache.program) |
| 8 | } |
| 9 | |
| 10 | fn test_first_protocol_compilation_outlives_an_arena_owned_vm() { |
| 11 | mut temporary := arena.new() |
| 12 | temporary.push() |
| 13 | mut first := new() |
| 14 | assert first.goops.deferred && !first.goops.protocols_ready |
| 15 | assert isnil(goops_protocol_cache.program) |
| 16 | _ := first.lookup('class-of')! |
| 17 | assert first.goops.protocols_ready && !first.goops.deferred |
| 18 | program := goops_protocol_cache.program |
| 19 | assert !isnil(program) && !temporary.owns(program) |
| 20 | assert !temporary.owns(program.code.doc.forms.data) |
| 21 | assert !temporary.owns(program.code.doc.arena.source_text().str) |
| 22 | temporary.pop() |
| 23 | temporary.free() |
| 24 | gc_collect() |
| 25 | mut second := new() |
| 26 | assert second.goops.deferred |
| 27 | assert second.eval('(class-name (class-of 1))')!.text() == '<integer>' |
| 28 | } |
| 29 | |