ktoml
ktoml copied to clipboard
Support tests from https://github.com/BurntSushi/toml-test
Need to create an adaptor test framework that will deserialize toml to class and after that serialize this class to json, so we will be able to adopt these tests in our library.
Test base: https://github.com/BurntSushi/toml-test
@akuleshov7 I've looked into it a little bit, and the main problem is that if we use the tool provided by toml-test, we don't know the shape of the data in the TOML. So, the way I see it, there are two possibilities:
- copy all the tests, and create the classes for each test
- have a way of parsing the TOML to an intermediate format (like JSON does with
Json.parseToJsonElement), and then be able to translate this format into JSON
Hm, @bishiboosh, and how about making a decoding with TOML, then make encoding of the resulted data with JSON and then compare results as JSON strings?
The fact is that to decode from TOML with ktoml, we need the class representation. The toml-test tools does not provide us with that, only the TOML file. The only ways I see of dealing with that input is like I said in my message, either copy all the tests and do the work done in toml-test ourselves (just use the test base), or implement a way to transform a TomlNode into a JsonElement (which could then be transformed to its JSON string representation)