v / vlib / toml / tests / array_of_tables_2_level_test.v
32 lines · 22 sloc · 608 bytes · f09826e928f9612bab9299faefff7cf34a503362
Raw
1import os
2import toml
3import toml.to
4
5const toml_text = '[[albums]]
6name = "Born to Run"
7
8 [[albums.songs]]
9 name = "Jungleland"
10
11 [[albums.songs]]
12 name = "Meeting Across the River"
13
14[[albums]]
15name = "Born in the USA"
16
17 [[albums.songs]]
18 name = "Glory Days"
19
20 [[albums.songs]]
21 name = "Dancing in the Dark"'
22
23const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))
24
25fn test_nested_array_of_tables() {
26 mut toml_doc := toml.parse_text(toml_text)!
27
28 toml_json := to.json(toml_doc)
29 eprintln(toml_json)
30
31 assert toml_json == os.read_file(fprefix + '.out')!
32}
33