-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate tests from the spec? #129
Comments
I thought there's a test for this, but maybe not as I can't find it now 🤔 Closest are https://github.com/BurntSushi/toml-test/blob/master/tests/valid/table/array-nest.toml and https://github.com/BurntSushi/toml-test/blob/master/tests/valid/table/array-table-array.toml Maybe I'm missing something; need to verify later.
How exactly would you do this? As in, I can see how you can take the specification and generate a lot of permutations based on that, but I'm not sure if that's really a good replacement for the tests we have now. One of the nice properties we have now is that tests are "grouped" and you can easily ignore a set of them, which is very useful especially when developing new implementations. We could perhaps add them as their own set of tests though.
We don't have a JSON file for the "invalid" tests; that's why it's in the binary. Maybe it should be encoded in the filename, or make it more obvious by grouping things in directories. I know quite a few people don't use the |
The closest I found were:
My thought that these auto-generated cases wouldn't be meant to replace existing tests and would live in a For more background: I was passively considering this idea but then I realized I was going to write a test that basically copies the spec, so I should ask about that idea first.
The two main Rust parsers do this (I'm the maintainer). For the one test for the unreleased version, I just have it skipped for now. |
I think adding this would make sense.
Speaking of which, I was updating the TOML wiki earlier today and it wasn't clear which TOML version https://github.com/toml-rs/toml supports; it's not mentioned in the README or in any of the source files (as far as I could find). I just assumed it supports 1.0.0 as it seemed maintained, but might be a good idea to mention this in the README or somewhere. |
Ah right; this one basically tests the behaviour with A lot of these tests could be grouped better. |
Added a new test in 102e04e |
How would you like the tom.io repo pulled in for extracting the test cases? And should I only generate cases for the latest spec version since the versioning story is still a little weak?
This covers dotted keys in table headers which has a different set of considerations for an implementer than dotted keys in key-value pairs considering some situations can be extended while others can't. |
I actually do not know the answer to that atm. |
I'd focus on TOML 1.0.0 to start with, but we do need to add TOML 1.1.0 as well at some point. Maybe the easiest is to just cp the ABNF file to But just do whatever you think makes sense. I don't have super-strong opinions.
These are already tested in the valid/key/dotted.toml test, right? Either way, always happy to add more tests if something is missing. |
As far as I can tell, I do not see a test for this rule within the spec
I was starting to write a test but I realized we could possibly code-generate tests from the spec seeing as the spec follows a specific pattern in marking whole documents invalid or specific parts.
Before starting on that, I wanted to gauge interest and preferred method for pulling in the toml.io repo (sub-module, sub-tree, having users do it by hand, etc) and if there is anything with versioning we should do (I feel like the json should be extended with versioning information rather than embedding it within the binary but the simplest to unblock is to only generate for the latest spec).
The text was updated successfully, but these errors were encountered: