1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

toml: support complex array-tables-array constructs (#12438)

This commit is contained in:
Larpon
2021-11-11 17:30:34 +01:00
committed by GitHub
parent 6c5dfc5c2f
commit 4b42dcad8e
4 changed files with 168 additions and 36 deletions

View File

@@ -0,0 +1,24 @@
import os
import toml
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) }
toml_json := toml_doc.to_json()
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) }
}