added missing test
This commit is contained in:
parent
543ec37975
commit
8d508162e8
1 changed files with 35 additions and 0 deletions
35
tests/js/trefbyvar.nim
Normal file
35
tests/js/trefbyvar.nim
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
discard """
|
||||||
|
output: '''0
|
||||||
|
5
|
||||||
|
0
|
||||||
|
5'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #2476
|
||||||
|
|
||||||
|
type A = ref object
|
||||||
|
m: int
|
||||||
|
|
||||||
|
proc f(a: var A) =
|
||||||
|
var b: A
|
||||||
|
b.new()
|
||||||
|
b.m = 5
|
||||||
|
a = b
|
||||||
|
|
||||||
|
var t: A
|
||||||
|
t.new()
|
||||||
|
|
||||||
|
echo t.m
|
||||||
|
t.f()
|
||||||
|
echo t.m
|
||||||
|
|
||||||
|
proc main =
|
||||||
|
# now test the same for locals
|
||||||
|
var t: A
|
||||||
|
t.new()
|
||||||
|
|
||||||
|
echo t.m
|
||||||
|
t.f()
|
||||||
|
echo t.m
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue