v / vlib / json / tests / json_decode_option_alias_field_test.v
16 lines · 12 sloc · 208 bytes · 57aae3fd20e98f3efe67102fdf375bfcf0835f0d
Raw
1module main
2
3import json
4
5struct Req {
6 height ?int
7 width ?i32
8}
9
10const payload = '{}'
11
12fn test_main() {
13 r := json.decode(Req, payload) or { panic(err) }
14 assert r.height == none
15 assert r.width == none
16}
17