MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / check_parse_error

Function check_parse_error

crates/hyperqueue/src/tests/utils.rs:4–16  ·  view source on GitHub ↗
(
    parser: F,
    input: &str,
    expected_error: &str,
)

Source from the content-addressed store, hash-verified

2use crate::common::parser2::CharParser;
3
4pub 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
18pub fn expect_parser_error<T: std::fmt::Debug>(parser: impl CharParser<T>, input: &str) -> String {
19 let error = parser.parse_text(input).unwrap_err();

Callers 3

test_parse_u32_emptyFunction · 0.85
test_parse_u32_invalidFunction · 0.85

Calls 1

consume_allFunction · 0.85

Tested by

no test coverage detected