| 1 | import os |
| 2 | import toml |
| 3 | import toml.to |
| 4 | |
| 5 | fn test_parse() { |
| 6 | toml_file := |
| 7 | os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) + |
| 8 | '.toml' |
| 9 | toml_doc := toml.parse_file(toml_file) or { panic(err) } |
| 10 | |
| 11 | toml_json := to.json(toml_doc) |
| 12 | out_file := |
| 13 | os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) + |
| 14 | '.out' |
| 15 | out_file_json := os.read_file(out_file) or { panic(err) } |
| 16 | println(toml_json) |
| 17 | assert toml_json == out_file_json |
| 18 | } |
| 19 | |