5514201b9c49 — Leonard Ritter 17 days ago
* `Rc`: added singleton test
1 files changed, 15 insertions(+), 0 deletions(-)

M testing/test_rc.sc
M testing/test_rc.sc +15 -0
@@ 154,4 154,19 @@ do
     test ((deleted_names @ 10) == "n322")
     test ((deleted_names @ 11) == "n33")
 
+do
+    # singleton test
+    T := (Rc i32)
+
+    fn singleton ()
+        using import Option
+        global data : (Option T)
+        if (not data)
+            data = (T 17)
+        deref ('unwrap data)
+
+    local example : T = (Rc.clone (singleton))
+    test (example == (singleton))
+    ;
+
 ;
  No newline at end of file