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

Testing #16

Closed
4 tasks done
harpocrates opened this issue Mar 17, 2017 · 0 comments
Closed
4 tasks done

Testing #16

harpocrates opened this issue Mar 17, 2017 · 0 comments
Milestone

Comments

@harpocrates
Copy link
Owner

harpocrates commented Mar 17, 2017

Here are some approaches to testing correctness of parsing and pretty printing

  • Hand written unit test
  • Use the unstable nightly -Z option for outputting a JSON of the AST, parse that JSON into our AST and diff them against the AST we get from regular parsing.
  • Parse, pretty print, re-parse it, and check that the two ASTs match.
  • Re-parse spanned sub-elements from the substring of the input, and check that the two ASTs match.
harpocrates added a commit that referenced this issue Apr 13, 2017
This commit adds some testing of 'Span' (at least on the handful of core types for which we are
also testing parsing). The testing procedure is:

  1. parse the initial values
  2. go through all of its subfields recursively
  3. for each one, use the parsed span to extract a substring ffrom the initial input
  4. re-parse that substring and make sure it matches

While doing this, I found and fixed a bunch of small edge cases. There are probably a couple tiny
ones still lurking about (and one with a TODO), but I now feel comfortable saying this
fixes #14 and addresses some points in #16.
harpocrates added a commit that referenced this issue Apr 14, 2017
Adds in place the machinery for parsing the JSON output of `rustc -Z ast-json` and diff-ing it
against our AST. This gets implemented as a seperate test suite. This is laying the groundwork
for #16.
harpocrates added a commit that referenced this issue Apr 15, 2017
The 'rustc-tests' now are fully integrated with the 'test-framework' library, so the testing output
should be nice-looking and helpful for debugging failing tests. No actual work was done in the
comparision though. Continues work on #16.
harpocrates added a commit that referenced this issue Apr 19, 2017
Completed difference tests for 'Pat', 'Ty', 'Expr', most of 'Stmt', 'Lit' (and
other more minor trees). Getting very close to #16.
harpocrates added a commit that referenced this issue Apr 20, 2017
Can almost diff 'ast.rs' - macros and view paths are still wonky. Also revamped tests to be
type-class based. The instances for 'NonEmpty', '[]', and 'Maybe' are particularly helpful.

Progress made towards #16.
@harpocrates harpocrates added this to the 0.1.0.0 milestone May 8, 2017
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

1 participant