| 1 | import os |
| 2 | import toml |
| 3 | import toml.to |
| 4 | |
| 5 | const toml_text = '[[albums]] |
| 6 | name = "Born to Run" |
| 7 | |
| 8 | [[albums.songs]] |
| 9 | name = "Jungleland" |
| 10 | |
| 11 | [[albums.songs]] |
| 12 | name = "Meeting Across the River" |
| 13 | |
| 14 | [[albums]] |
| 15 | name = "Born in the USA" |
| 16 | |
| 17 | [[albums.songs]] |
| 18 | name = "Glory Days" |
| 19 | |
| 20 | [[albums.songs]] |
| 21 | name = "Dancing in the Dark"' |
| 22 | |
| 23 | const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.')) |
| 24 | |
| 25 | fn 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 | |