Provide integration with toml-test
The toml-test test suite has many test cases: https://github.com/toml-lang/toml-test – it would be nice if Tomlet could provide an integration for it to validate conformance to the TOML spec.
Eventually I'm hoping all (maintained) parsers can be added to https://toml-lang.github.io/toml-test-matrix.
Integrating support should be fairly easy: you need to build a binary that converts TOML to JSON with some type information and vice versa; see the toml-test README. I'd do it myself, but I never did much C#, so it's relatively difficult/time-consuming for me to write.
Also see the tomlyn code for a C# example, which can probably be adapted:
https://github.com/toml-lang/toml-test-matrix/blob/main/scripts/cs-tomlyn-decoder.cs
https://github.com/toml-lang/toml-test-matrix/blob/main/scripts/cs-tomlyn-encoder.cs
Feel free to let me know if you have any questions/problems.
My expectation is that a lot of these tests would not pass, because Tomlet is opinionated on things such as ordering and whitespace in the TOML it produces (i.e. it does not match 1:1 the order of input data), which likely will not match expected test output, and I have no interest in changing this behavior. Feel free to let me know if I'm mistaken and the test binaries ignore such things.
It doesn't validate ordering, as ordering isn't defined in TOML. So any order should work. Similarly, anything that's "semantically equal" is considered "equal", for example:
[tbl]
a.b = 0x01
Is considered equal to:
tbl = {a = {b = 1}}
The exact formatting of inline tables vs. [..] tables or hex vs. decimal or any of that isn't validated.
Then this might be feasible. I'll take a look at some point (ideally in the near future), but I can't be sure exactly when I'll have time.
Of course, no hurries.
The above commit creates a basic decoder project.
174 of the 185 "valid" tests pass, with most of the failures being what I had decided was undefined behaviour but which the test project expects to be valid (I'll have to re-read the spec on that), and the rest minor issues in handling of very specific dotted keys.
291 of the 371 "invalid" tests pass. I'm mostly too lenient on [table] declarations and multiline strings.
Cheers, seems to work well; I added it to the toml-test-matrix.
Many implementations fail some "invalid" tests; some of them are a bit pedantic and not really all that important IMHO. A parser is still marked as "compliant" with failing invalid tests.