diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-04 14:24:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 01:24:40 -0500 |
commit | 7d640e0943679a772f9595ef3be56fe2158b0912 (patch) | |
tree | b25f64f7baf34f5dc4180650432841d76273c0bd /tests | |
parent | b0e26d8fbffd044aa3f23fc680e6a2e666593399 (diff) | |
download | Nim-7d640e0943679a772f9595ef3be56fe2158b0912.tar.gz |
fix #15835 (#15838)
* fix #15835 * add tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/t15835.nim | 17 |
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) |