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 attribute, for testing the library and compile-time error. #29

Open
ptal opened this issue Jul 18, 2014 · 2 comments
Open

Testing attribute, for testing the library and compile-time error. #29

ptal opened this issue Jul 18, 2014 · 2 comments

Comments

@ptal
Copy link
Owner

ptal commented Jul 18, 2014

We want to add static analysis, before that, we should be able to test our grammar:

peg!(
  grammar arith;

  // The rule 'le' is not reachable.
  #![test(warn(unreachable_rule(le))]

  comparison = lt / le
  lt = "<" spacing
  le = "<=" spacing
@ptal
Copy link
Owner Author

ptal commented Jul 27, 2016

We will keep this kind of test simple in a first time because we don't know how the Rust procedural macros will evolve and what kind of support they could offer later. We propose the following:

#![compile(error, UnreachableRule)]

error can be replaced by warning or note or help. This follows the error level in rustc_errors::Level.

It can also tests for parse errors, therefore we force global attribute to be declared in the beginning.

@ptal
Copy link
Owner Author

ptal commented Dec 29, 2020

See if trybuild is suited for this task.

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

No branches or pull requests

1 participant