Commit 31149c7e authored by Xavier Thompson's avatar Xavier Thompson

Add unit test for refcount of cypclass loop variables

parent a2406827
...@@ -92,3 +92,26 @@ def test_stack_refcount(): ...@@ -92,3 +92,26 @@ def test_stack_refcount():
return -3 return -3
return 0 return 0
def test_loop_variable_refcount():
"""
>>> test_loop_variable_refcount()
Value destroyed
0
"""
s = Stack()
s.push(Value())
for val in s:
refcnt = Cy_GETREF(val)
if refcnt != 3:
print(refcnt)
return -1
for val in s:
refcnt = Cy_GETREF(val)
if refcnt != 3:
print(refcnt)
return -1
return 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment