Macro pest::fails_with

source ·
macro_rules! fails_with {
    ( parser: $parser:ident, input: $string:expr, rule: $rules:tt :: $rule:tt,
      positives: $positives:expr, negatives: $negatives:expr, pos: $pos:expr ) => { ... };
}
Expand description

Testing tool that compares produced errors.

This macro takes several arguments:

  • parser - name of the data structure implementing Parser
  • input - input to be tested against
  • rule - Rule which will be run
  • positives - positive Rule attempts that failed
  • negatives - negative Rule attempts that failed
  • pos - byte position of failure

§Examples

fails_with! {
    parser: AbcParser,
    input: "abcdf",
    rule: Rule::a,
    positives: vec![Rule::c],
    negatives: vec![],
    pos: 4
};