ktoml icon indicating copy to clipboard operation
ktoml copied to clipboard

Support tests from https://github.com/BurntSushi/toml-test

Open orchestr7 opened this issue 4 years ago • 3 comments

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

orchestr7 avatar May 16 '21 21:05 orchestr7

@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

bishiboosh avatar Mar 05 '22 16:03 bishiboosh

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?

orchestr7 avatar Mar 05 '22 16:03 orchestr7

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)

bishiboosh avatar Mar 05 '22 16:03 bishiboosh