diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2018-04-04 22:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 22:36:18 +0100 |
commit | 58dc8a399efc5849ccc8109e1ee8d26c120a7539 (patch) | |
tree | 54c6c50c8e73cd763c3a810f5ab4f6cf8c645a8f /tests/stdlib | |
parent | 5d46e1eaa2861b54b290b65f43056295aba953f8 (diff) | |
parent | c7cba5e6f03ef790c78485e8ff23a1b0794cd884 (diff) | |
download | Nim-58dc8a399efc5849ccc8109e1ee8d26c120a7539.tar.gz |
Merge pull request #7450 from cabhishek/devel
Fixes #6902
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/tjsonmacro.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/stdlib/tjsonmacro.nim b/tests/stdlib/tjsonmacro.nim index e8740c591..f13d2e5cb 100644 --- a/tests/stdlib/tjsonmacro.nim +++ b/tests/stdlib/tjsonmacro.nim @@ -330,6 +330,21 @@ when isMainModule: doAssert jDeser[0].n2.get() == "ABC" doAssert jDeser[1].n2.isNone() + # Issue #6902 + type + Obj = object + n1: int + n2: Option[int] + n3: Option[string] + n4: Option[bool] + + var j0 = parseJson("""{"n1": 1, "n2": null, "n3": null, "n4": null}""") + let j0Deser = j0.to(Obj) + doAssert j0Deser.n1 == 1 + doAssert j0Deser.n2.isNone() + doAssert j0Deser.n3.isNone() + doAssert j0Deser.n4.isNone() + # Table[T, Y] support. block: type |