murano/murano/tests/unit/dsl/meta/TestGC.yaml

63 lines
1.2 KiB
YAML

Name: TestGCNode
Extends: Node
Methods:
.init:
Body:
- $.find(Node)
foo:
Body:
- trace(foo)
destructionHandler:
Arguments:
- obj:
Contract: $.class(TestGCNode).notNull()
Body:
- trace('Destruction of {0}'.format($obj.value))
.destroy:
Body:
- trace($.value)
---
Namespaces:
sys: io.murano.system
Name: TestGC
Methods:
testObjectsCollect:
Body:
- $model:
:TestGCNode:
value: A
nodes:
- :TestGCNode:
value: B
- new($model)
- sys:GC.collect()
testObjectsCollectWithSubscription:
Body:
- $model:
:TestGCNode:
value: A
nodes:
:TestGCNode:
value: B
- $x: new($model)
- sys:GC.subscribeDestruction($x, $this, _handler)
- sys:GC.subscribeDestruction($x.nodes[0], $this, _handler)
- sys:GC.subscribeDestruction($x.nodes[0], $x, destructionHandler)
- $x: null
- sys:GC.collect()
_handler:
Arguments:
- obj:
Contract: $.class(TestGCNode).notNull()
Body:
- trace('Destroy ' + $obj.value)