use std::fmt::Debug;
use aoc_parse::{parser, prelude::*};
#[track_caller]
fn assert_parse_eq
(parser: P, s: &str, expected: E)
where
P: Parser,
P::Output: PartialEq + Debug,
E: Debug,
{
match parser.parse(s) {
Err(err) => panic!("parse failed: {}", err),
Ok(val) => assert_eq!(val, expected),
}
}
#[test]
fn test_custom_parser_combinator() {
// Users can actually kind of write their own combinators from scratch,
// just using the public API. Make sure such functions are callable.
fn triplicate(parser: P) -> impl Parser