Skip to content
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

work towards toml based tests #21

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

work towards toml based tests #21

wants to merge 1 commit into from

Conversation

ratmice
Copy link
Owner

@ratmice ratmice commented May 28, 2022

supersedes #20

This will eventually be similar to below for tests of the form:

[tests]
extension = ".foo",
tests = ["some sources",
'''
multi
line
sources
'''
]

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.

@ratmice ratmice force-pushed the toml_tests branch 2 times, most recently from 923d9ac to fbcc5f0 Compare May 30, 2022 03:39
@ratmice
Copy link
Owner Author

ratmice commented May 30, 2022

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...

@ratmice ratmice force-pushed the toml_tests branch 9 times, most recently from 2bafe4e to a91e2e3 Compare May 31, 2022 04:31
@ratmice
Copy link
Owner Author

ratmice commented May 31, 2022

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant