fix another enron test
This commit is contained in:
parent
950947ee3e
commit
88fc3c54f2
1 changed files with 15 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use std::borrow::Cow;
|
||||||
use nom::{
|
use nom::{
|
||||||
IResult,
|
IResult,
|
||||||
Parser,
|
Parser,
|
||||||
|
@ -111,13 +112,13 @@ fn strict_local_part(input: &str) -> IResult<&str, String> {
|
||||||
/// obs_local_part.
|
/// obs_local_part.
|
||||||
///
|
///
|
||||||
/// ```abnf
|
/// ```abnf
|
||||||
/// obs-local-part = *(*"." word)
|
/// obs-local-part = *("." / word)
|
||||||
/// ```
|
/// ```
|
||||||
fn obs_local_part(input: &str) -> IResult<&str, String> {
|
fn obs_local_part(input: &str) -> IResult<&str, String> {
|
||||||
fold_many0(
|
fold_many0(
|
||||||
pair(opt(is_a(".")), word),
|
alt((map(is_a("."), Cow::Borrowed), word)),
|
||||||
String::new,
|
String::new,
|
||||||
|acc, (dots, txt)| acc + dots.unwrap_or("") + &txt)(input)
|
|acc, chunk| acc + &chunk)(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Domain
|
/// Domain
|
||||||
|
@ -303,4 +304,15 @@ mod tests {
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_enron3() {
|
||||||
|
assert_eq!(
|
||||||
|
addr_spec("ecn2760.conf.@enron.com"),
|
||||||
|
Ok(("", AddrSpec {
|
||||||
|
local_part: "ecn2760.conf.".into(),
|
||||||
|
domain: "enron.com".into(),
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue