v2 / vlib / json / tests / json_decode_with_option_arg_test.v
19 lines · 16 sloc · 297 bytes · 8ebbacecd60366ac4ba68aa35f9b0e7a0e56ff61
Raw
1import json
2import os
3
4struct DbConfig {}
5
6fn test_json_decode_with_option_arg() {
7 if ret := print_info() {
8 println(ret)
9 } else {
10 println(err)
11 }
12 assert true
13}
14
15fn print_info() !string {
16 dbconf := json.decode(DbConfig, os.read_file('dbconf.json')!)!
17 println(dbconf)
18 return '${dbconf}'
19}
20