mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
17
tests/stdlib/t15835.nim
Normal file
17
tests/stdlib/t15835.nim
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user