chore: add test with custom type
This commit is contained in:
parent
62e38ccf6f
commit
38e035037c
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,7 @@ where
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::structs::Pair;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn should_parse_empty_string_as_none() {
|
fn should_parse_empty_string_as_none() {
|
||||||
|
@ -34,4 +35,13 @@ mod tests {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_parse_pair() {
|
||||||
|
let estr = EString::from("1+2");
|
||||||
|
match estr.parse::<Option<Pair<i32, '+', i32>>>() {
|
||||||
|
Ok(res) => assert_eq!(res, Some(Pair(1, 2))),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue