2021-11-11 19:30:34 +03:00
|
|
|
import os
|
|
|
|
import toml
|
2021-11-18 14:27:59 +03:00
|
|
|
import toml.to
|
2021-11-11 19:30:34 +03:00
|
|
|
|
|
|
|
const (
|
|
|
|
toml_text = '[[a]]
|
|
|
|
[[a.b]]
|
|
|
|
[a.b.c]
|
|
|
|
d = "val0"
|
|
|
|
[[a.b]]
|
|
|
|
[a.b.c]
|
|
|
|
d = "val1"
|
|
|
|
'
|
|
|
|
)
|
|
|
|
|
|
|
|
fn test_nested_array_of_tables() {
|
|
|
|
mut toml_doc := toml.parse(toml_text) or { panic(err) }
|
|
|
|
|
2021-11-18 14:27:59 +03:00
|
|
|
toml_json := to.json(toml_doc)
|
2021-11-11 19:30:34 +03:00
|
|
|
|
|
|
|
eprintln(toml_json)
|
|
|
|
assert toml_json == os.read_file(
|
|
|
|
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
|
|
|
|
'.out') or { panic(err) }
|
|
|
|
}
|