add testcase
This commit is contained in:
parent
077eba7b38
commit
8ec3c141ae
1 changed files with 25 additions and 0 deletions
|
|
@ -4,6 +4,9 @@ true
|
||||||
true
|
true
|
||||||
alpha 100
|
alpha 100
|
||||||
omega 200
|
omega 200
|
||||||
|
Some(null)
|
||||||
|
None[JsonNode]
|
||||||
|
(numeric: "")
|
||||||
'''
|
'''
|
||||||
joinable: false
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
@ -123,3 +126,25 @@ var foo = Foo(a2: "", a4: @[], a6: @[1])
|
||||||
foo.a6.setLen 0
|
foo.a6.setLen 0
|
||||||
doAssert $$foo == """{"a1": "", "a2": "", "a3": [], "a4": [], "a5": [], "a6": []}"""
|
doAssert $$foo == """{"a1": "", "a2": "", "a3": [], "a4": [], "a5": [], "a6": []}"""
|
||||||
testit(foo)
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue