1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix json decode with optional argument (fix #13943) (#13958)

This commit is contained in:
yuyi
2022-04-07 00:34:22 +08:00
committed by GitHub
parent 56e6fd01c5
commit c9dcdf6744
3 changed files with 38 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
import json
struct TodoDto {
foo int
}
fn test_decode_with_encode_arg() ? {
body := TodoDto{}
ret := json.decode(TodoDto, json.encode(body)) ?
println(ret)
assert ret.foo == 0
}