v2 / vlib / v / checker / tests / json_decode.vv
16 lines · 13 sloc · 258 bytes · 992b50219833bcc2e6381a8c1792904ae7a298ce
Raw
1import json
2
3struct St {
4 a string
5}
6
7type Num = u8
8
9fn main() {
10 json.decode(St, '{a: ""}')! // OK
11 json.decode(St2, '{a: ""}')! // BAD
12 json.decode(St)! // BAD
13 json.decode(string, '""')! // BAD
14 json.decode(Num, '5')! // BAD
15 json.decode(St, 6)! // BAD
16}
17