| 1 | import os |
| 2 | import toml |
| 3 | import toml.to |
| 4 | |
| 5 | const 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 | |
| 14 | fn 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 |