summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-01-17 02:37:06 -0800
committerGitHub <noreply@github.com>2021-01-17 11:37:06 +0100
commit6c07b0a1f8daf96078ae68b83ead1d48675969d7 (patch)
tree7d10eff7fef51492f9129a17d417640dc70679f6 /tests
parent44ceefa9fefca58ba32e9638f754d7f4ca8a2b82 (diff)
downloadNim-6c07b0a1f8daf96078ae68b83ead1d48675969d7.tar.gz
jsonutils.jsonTo: support opt (#16739)
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tjsonutils.nim3
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]()): "[]"