v / vlib / json / tests / json_i32_test.v
16 lines · 13 sloc · 282 bytes · 8ebbacecd60366ac4ba68aa35f9b0e7a0e56ff61
Raw
1import json
2
3pub struct StructB {
4 kind string
5 value i32
6}
7
8fn test_json_i32() {
9 struct_b := json.decode(StructB, '{"kind": "Int32", "value": 100}')!
10 assert struct_b == StructB{
11 kind: 'Int32'
12 value: 100
13 }
14
15 assert json.encode(struct_b) == '{"kind":"Int32","value":100}'
16}
17