summary refs log tree commit diff stats
path: root/tests/stdlib/t15835.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/t15835.nim')
-rw-r--r--tests/stdlib/t15835.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/stdlib/t15835.nim b/tests/stdlib/t15835.nim
new file mode 100644
index 000000000..bddfa87aa
--- /dev/null
+++ b/tests/stdlib/t15835.nim
@@ -0,0 +1,17 @@
+import json
+
+type
+  Foo = object
+    ii*: int
+    data*: JsonNode
+
+block:
+  const jt = """{"ii": 123, "data": ["some", "data"]}"""
+  let js = parseJson(jt)
+  discard js.to(Foo)
+
+block:
+  const jt = """{"ii": 123}"""
+  let js = parseJson(jt)
+  doAssertRaises(KeyError):
+    echo js.to(Foo)