vxx2 / vlib / v / checker / tests / json_decode.vv
17 lines · 14 sloc · 292 bytes · 4c43fb1afebb48c1de2822df1133945ccd92ac97
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 json.decode(&[]St, '[]')! // BAD
17}
18