Open ratmice opened 2 years ago
Changing strategy... extension gets removed from file contents and we use .file_extension.toml
by default, there will probably be a nimbleparse.toml setting though that you can change
the default being something like:
[[tests]]
parser_extension = ".file_extension"
toml_test_extension = ".file_extension.toml"
This should resolve most of the problems, and generally work out of the box... Not sure if i'll do it on top of this branch or start fresh...
So, this is at least tolerable, It could be cleaned up especially around the globs/extension map, and introducing some notion of an 'file_extension id'. I'd rather just wait to do that until there are less branches in motion to avoid conflicts.
i'm going to wait and see if we can get spans out of ron before I implement the actual toml parsing aspect of this though...
supersedes #20
This will eventually be similar to below for tests of the form:
I.e. arrays of source snippets we want to parse but are so short putting them all in their own individual files becomes annoying. This may or may not go back to being ron based as in #20 (I prefer ron's rust-like strings) but currently we can't get at spans for ron easily. Whatever format we eventually choose most of the code will end up being shared anyways.
Edit: One thing I really don't like about this form, is that it means parsing the toml/ron/whatever twice, once to pull out the extension for routing, and once to pull out the actual data. I think ideally there would be a way to just partially parse this e.g. via
#![attribute(file_extension = ".foo")]
or perhaps more familiar#![cfg(file_extension = ".foo")]
Two things I really don't like about is if you change the extension in the data file, you must find some way to invalidate the old extension, which could be routed to a completely different parser, so In theory main is going to have a map for each test list so it can even notice the extension has changed.