Closed real-felix closed 6 years ago
use pom::{ combinator::{Combinator, seq}, Parser, }; enum Operation { Data, } fn operation<'a>() -> Combinator<impl Parser<'a, u8, Output=Operation>> { seq(b"DAT").map(|_| Operation::Data) } #[test] fn operation_is_ok() { assert_eq!( super::operation().parse(b"DAT"), Ok(Operation::Data) ); assert_eq!( super::operation().parse(b"Dat"), Ok(Operation::Data) ); assert_eq!( super::operation().parse(b"dat"), Ok(Operation::Data) ); assert!(super::operation().parse(b"whatever").is_err()); }
How to make the test ok?
Maybe create a new combinator, change this line to match case insensitively.
It worked, thanks! I used the 1.* version, tho
How to make the test ok?