manual count

This commit is contained in:
Jaremy Creechley 2023-09-14 15:05:38 -07:00
parent 185f1248e2
commit 8a222430a6
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300

View File

@ -109,4 +109,18 @@ suite "Share buffer test":
b.release()
check intref[] == 0
test "test manual release / decr":
echo "\nintref setup:\n"
let intref: ref int = new(ref int)
intref[] = 40
var b = newSharedPtr(unsafeIsolate TestObjGen[int](val: intref), manualCount = 2)
try:
echo "a[]: ", b[]
check b[].val[] == 40
finally:
b.decr()
check intref[] == 40
b.release()
check intref[] == 0
# TODO: add async test