diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-01-17 02:37:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-17 11:37:06 +0100 |
commit | 6c07b0a1f8daf96078ae68b83ead1d48675969d7 (patch) | |
tree | 7d10eff7fef51492f9129a17d417640dc70679f6 /tests/stdlib/tjsonutils.nim | |
parent | 44ceefa9fefca58ba32e9638f754d7f4ca8a2b82 (diff) | |
download | Nim-6c07b0a1f8daf96078ae68b83ead1d48675969d7.tar.gz |
jsonutils.jsonTo: support opt (#16739)
Diffstat (limited to 'tests/stdlib/tjsonutils.nim')
-rw-r--r-- | tests/stdlib/tjsonutils.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/stdlib/tjsonutils.nim b/tests/stdlib/tjsonutils.nim index 06d01a9fb..24bc9a3cd 100644 --- a/tests/stdlib/tjsonutils.nim +++ b/tests/stdlib/tjsonutils.nim @@ -137,6 +137,9 @@ template fn() = var b: Bar fromJson(b, parseJson """{"foo": {"b": "bbb"}}""", Joptions(allowExtraKeys: true, allowMissingKeys: true)) doAssert b == Bar(foo: Foo(a: 0, b: "bbb", c: 0.0)) + block: # jsonTo with `opt` + let b2 = """{"foo": {"b": "bbb"}}""".parseJson.jsonTo(Bar, Joptions(allowExtraKeys: true, allowMissingKeys: true)) + doAssert b2 == Bar(foo: Foo(a: 0, b: "bbb", c: 0.0)) block testHashSet: testRoundtrip(HashSet[string]()): "[]" |