From a89ed6f10cee820e772f90f4753b084b3fcd5138 Mon Sep 17 00:00:00 2001 From: Atila Neves Date: Fri, 22 Sep 2023 13:00:32 -0700 Subject: [PATCH] Cover atomic increase of ref count --- tests/ut/ref_counted.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/ut/ref_counted.d b/tests/ut/ref_counted.d index 655bd9d..fad6da4 100644 --- a/tests/ut/ref_counted.d +++ b/tests/ut/ref_counted.d @@ -177,8 +177,10 @@ mixin TestUtils; @("default.struct.shared") @system unittest { { - auto ptr = RefCounted!(shared SharedStruct)(5); + auto ptr0 = RefCounted!(shared SharedStruct)(5); SharedStruct.numStructs.shouldEqual(1); + auto ptr2 = ptr0; // copying the pointer ups the ref count but not # of structs + SharedStruct.numStructs.should == 1; } SharedStruct.numStructs.shouldEqual(0); }