closes #985
This commit is contained in:
parent
d065931991
commit
c00de13e1f
1 changed files with 25 additions and 1 deletions
|
|
@ -1,7 +1,12 @@
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
output: '''test created
|
output: '''test created
|
||||||
test destroyed 0'''
|
test destroyed 0
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
Pony is dying!'''
|
||||||
cmd: '''nim c --newruntime $file'''
|
cmd: '''nim c --newruntime $file'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -33,3 +38,22 @@ proc main =
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
# bug #985
|
||||||
|
|
||||||
|
type
|
||||||
|
Pony = object
|
||||||
|
name: string
|
||||||
|
|
||||||
|
proc `=destroy`(o: var Pony) =
|
||||||
|
echo "Pony is dying!"
|
||||||
|
|
||||||
|
proc getPony: Pony =
|
||||||
|
result.name = "Sparkles"
|
||||||
|
|
||||||
|
iterator items(p: Pony): int =
|
||||||
|
for i in 1..4:
|
||||||
|
yield i
|
||||||
|
|
||||||
|
for x in getPony():
|
||||||
|
echo x
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue