v2 / vlib / toml / tests / array_of_tables_array_test.v
23 lines · 19 sloc · 485 bytes · f09826e928f9612bab9299faefff7cf34a503362
Raw
1import os
2import toml
3import toml.to
4
5const toml_text = '[[a]]
6 [[a.b]]
7 [a.b.c]
8 d = "val0"
9 [[a.b]]
10 [a.b.c]
11 d = "val1"
12'
13
14fn test_nested_array_of_tables() {
15 mut toml_doc := toml.parse_text(toml_text) or { panic(err) }
16
17 toml_json := to.json(toml_doc)
18
19 eprintln(toml_json)
20 assert toml_json == os.read_file(
21 os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
22 '.out') or { panic(err) }
23}
24