2021-09-24 20:13:52 +02:00
|
|
|
import os
|
|
|
|
import toml
|
2021-11-18 12:27:59 +01:00
|
|
|
import toml.to
|
2021-09-24 20:13:52 +02:00
|
|
|
|
|
|
|
fn test_parse() {
|
|
|
|
toml_file :=
|
|
|
|
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
|
|
|
|
'.toml'
|
2022-03-18 22:32:06 +01:00
|
|
|
toml_doc := toml.parse_file(toml_file) or { panic(err) }
|
2021-09-24 20:13:52 +02:00
|
|
|
|
2021-11-18 12:27:59 +01:00
|
|
|
toml_json := to.json(toml_doc)
|
2021-09-24 20:13:52 +02:00
|
|
|
out_file :=
|
|
|
|
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
|
|
|
|
'.out'
|
|
|
|
out_file_json := os.read_file(out_file) or { panic(err) }
|
|
|
|
println(toml_json)
|
|
|
|
assert toml_json == out_file_json
|
|
|
|
}
|