summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2020-11-12 23:58:42 +0800
committerflywind <xzsflywind@gmail.com>2020-11-12 23:58:42 +0800
commit8ec3c141ae28616382a82235b2f4049eaa0ab0d7 (patch)
tree0b6884fc00637f4fc9648be0a063a99c0caef590 /tests
parent077eba7b388259ecca7e9e7990f48efe9e3641c5 (diff)
downloadNim-8ec3c141ae28616382a82235b2f4049eaa0ab0d7.tar.gz
add testcase
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tmarshal.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/stdlib/tmarshal.nim b/tests/stdlib/tmarshal.nim
index fc5703a03..315036631 100644
--- a/tests/stdlib/tmarshal.nim
+++ b/tests/stdlib/tmarshal.nim
@@ -4,6 +4,9 @@ true
 true
 alpha 100
 omega 200
+Some(null)
+None[JsonNode]
+(numeric: "")
 '''
 joinable: false
 """
@@ -123,3 +126,25 @@ var foo = Foo(a2: "", a4: @[], a6: @[1])
 foo.a6.setLen 0
 doAssert $$foo == """{"a1": "", "a2": "", "a3": [], "a4": [], "a5": [], "a6": []}"""
 testit(foo)
+
+import options, json
+
+# bug #15934
+block:
+  let
+    a1 = some(newJNull())
+    a2 = none(JsonNode)
+  echo ($$a1).to[:Option[JsonNode]]
+  echo ($$a2).to[:Option[JsonNode]]
+
+
+#  bug #15620
+block:
+  let str = """{"numeric": null}"""
+
+  type
+    LegacyEntry = object
+      numeric: string
+
+  let test = to[LegacyEntry](str)
+  echo test