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

Ultimate test of parsing #19

Closed
dtolnay opened this issue Sep 30, 2016 · 2 comments
Closed

Ultimate test of parsing #19

dtolnay opened this issue Sep 30, 2016 · 2 comments
Assignees

Comments

@dtolnay
Copy link
Owner

dtolnay commented Sep 30, 2016

Write a test to:

  1. Iterate through Rust files in a directory
  2. Parse using syn >> print using syn >> parse using syntex
  3. Parse the original using syntex
  4. Assert that the syntex AST from 2 and 3 are identical

I think this would give us more confidence in the parser than any unit test suite we could write, and it is also far easier to implement than individually testing every parser element. Once we make more progress on #4 we could run this test against a large repo like the full rustc source code.

cc @gregkatz. I plan to work on this today or tomorrow. In the meantime you don't have to worry about unit testing parsers you write (unless it is useful to you in implementing them). Let's focus on flying through #4 without tests and leave testing to this one.

@dtolnay dtolnay self-assigned this Sep 30, 2016
@gregkatz
Copy link
Contributor

Sure thing. I'll skip the unit tests in the future.

@dtolnay
Copy link
Owner Author

dtolnay commented Oct 1, 2016

Added in 4a51dc7. Any *.rs file in the tests/cases directory will be tested as outlined above.

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

No branches or pull requests

2 participants