(
parser: F,
input: &str,
expected_error: &str,
)
| 2 | use crate::common::parser2::CharParser; |
| 3 | |
| 4 | pub fn check_parse_error<F: FnMut(&str) -> NomResult<O>, O>( |
| 5 | parser: F, |
| 6 | input: &str, |
| 7 | expected_error: &str, |
| 8 | ) { |
| 9 | match consume_all(parser, input) { |
| 10 | Err(e) => { |
| 11 | let output = format!("{e:?}"); |
| 12 | assert_eq!(output, expected_error); |
| 13 | } |
| 14 | _ => panic!("The parser should have failed"), |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | pub fn expect_parser_error<T: std::fmt::Debug>(parser: impl CharParser<T>, input: &str) -> String { |
| 19 | let error = parser.parse_text(input).unwrap_err(); |
no test coverage detected