summary refs log tree commit diff stats
path: root/tests/stdlib/toptions.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/toptions.nim')
-rw-r--r--tests/stdlib/toptions.nim22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/stdlib/toptions.nim b/tests/stdlib/toptions.nim
index 4764ce05f..63a10e746 100644
--- a/tests/stdlib/toptions.nim
+++ b/tests/stdlib/toptions.nim
@@ -1,9 +1,13 @@
 discard """
+  matrix: "--mm:refc; --mm:orc"
   targets: "c js"
 """
 
 import std/[json, options]
 
+import std/assertions
+import std/objectdollar
+
 
 # RefPerson is used to test that overloaded `==` operator is not called by
 # options. It is defined here in the global scope, because otherwise the test
@@ -82,8 +86,8 @@ proc main() =
       doAssert(stringNone.get("Correct") == "Correct")
 
     block stringify:
-      doAssert($(some("Correct")) == "Some(\"Correct\")")
-      doAssert($(stringNone) == "None[string]")
+      doAssert($(some("Correct")) == "some(\"Correct\")")
+      doAssert($(stringNone) == "none(string)")
 
     disableJsVm:
       block map_with_a_void_result:
@@ -155,7 +159,7 @@ proc main() =
         name: string
 
       let nobody = none(Named)
-      doAssert($nobody == "None[Named]")
+      doAssert($nobody == "none(Named)")
 
     # "$ on type with name()"
     block:
@@ -163,7 +167,7 @@ proc main() =
         myname: string
 
       let noperson = none(Person)
-      doAssert($noperson == "None[Person]")
+      doAssert($noperson == "none(Person)")
 
     # "Ref type with overloaded `==`"
     block:
@@ -190,8 +194,14 @@ proc main() =
       block:
         let x = none(cstring)
         doAssert x.isNone
-        doAssert $x == "None[cstring]"
-
+        doAssert $x == "none(cstring)"
 
 static: main()
 main()
+
+when not defined(js):
+  block: # bug #22932
+    var it = iterator: int {.closure.} = discard
+    doAssert it.option.isSome # Passes.
+    it = nil
+    doAssert it.option.isNone # Passes.