-
Notifications
You must be signed in to change notification settings - Fork 7
Test suite #49
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
Comments
For the lexer, recently I've been testing by linking to rustc using I don't think that would be a sensible thing for a testsuite in the spec to do, but I've found it a lot more practical than testing via Maybe it would be thinkable for rustc to add a I suppose there's a sense in which anything more internal than "does this program compile?" is out of scope for the spec, but pragmatically if we're going to try to document the lexer as a stage of its own it would be nice to have a way to test what the spec ends up saying directly. |
After the Conversation here: https://hackmd.io/jR6-og7YQ9WFIz1wpaDqhw |
Update on this:
I still think there is some work to do here.
|
I think it would be very helpful to have a test suite integrated with the spec.
Benefits
There are several reasons:
As an example, Ferrocene has a Traceability matrix report that shows connects to the rustc testsuite to sections within the spec. The Reference uses the
rustdoc
test functionality to verify examples within the source text.Where are the tests?
My suggestion would be to have an independent test suite that lives with the spec (instead of, for example, linking to rustc's test suite). That has a few benefits:
Of course the major downside is actually writing the tests. However, I expect that authors will need to write test code anyways to verify their own understanding.
Viewing the tests
I would recommend making it easy to view the test files from the spec. I don't know exactly what that would look like, but maybe there could be some kind of link or icon next to each rule name, and that takes you to the tests linked with that rule? This will be hard to not make it too noisy.
Inline or outline tests
I expect there will be two kinds of tests:
"Inline" and "outline" have different meanings in different contexts:
Inline test benefits:
Outline test benefits:
I would recommend integrating the test suite with inline examples, to make it easier to author and review simple code snippets. Larger examples should use mdbook includes if desired (see how TRPL does this, and #19). However, most rules should not have their tests displayed in the text, but instead accessed through some relatively easy means (like a link). #19 covers what the guidelines should be for showing in-text examples.
Tooling
I would expect the tests to be roughly the same as what rustc uses. Whether that is ui_test or compiletest, I don't know. I'm only vaguely aware of ui_test, so I'm not sure what its limitations are.
The text was updated successfully, but these errors were encountered: