diff options
Diffstat (limited to 'tests/run/tdestructor.nim')
-rw-r--r-- | tests/run/tdestructor.nim | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/tests/run/tdestructor.nim b/tests/run/tdestructor.nim deleted file mode 100644 index 8aae2fce2..000000000 --- a/tests/run/tdestructor.nim +++ /dev/null @@ -1,26 +0,0 @@ -discard """ - output: '''some text -Destructor called!''' -""" - -type - TMyObj = object - x, y: int - p: pointer - -proc destruct(o: var TMyObj) {.destructor.} = - if o.p != nil: dealloc o.p - echo "Destructor called!" - -proc open: TMyObj = - # allow for superfluous () - result = (TMyObj(x: 1, y: 2, p: alloc(3))) - - -proc `$`(x: TMyObj): string = $x.y - -proc main() = - var x = open() - echo "some text" - -main() |