Add tests for the nil passthrough
This commit is contained in:
parent
4ff5112803
commit
db7fee6303
1 changed files with 8 additions and 0 deletions
|
|
@ -936,6 +936,14 @@ when isMainModule:
|
||||||
raise newException(EInvalidValue, "That line was expected to fail")
|
raise newException(EInvalidValue, "That line was expected to fail")
|
||||||
except EInvalidIndex: echo()
|
except EInvalidIndex: echo()
|
||||||
|
|
||||||
|
let passthroughTest = parseJson"""{ "a": [1, 2, 3, 4], "b": "asd" }"""
|
||||||
|
# nil passthrough
|
||||||
|
assert(passthroughTest["doesnt_exist"][1] == nil)
|
||||||
|
assert(passthroughTest["doesnt_exist"]["anything"] == nil)
|
||||||
|
# default param
|
||||||
|
assert(passthroughTest["doesnt_exist",%true].bval)
|
||||||
|
assert(passthroughTest["doesnt_exist"][1,%true].bval)
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
while true:
|
while true:
|
||||||
var json = stdin.readLine()
|
var json = stdin.readLine()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue