Skip to content

Commit

Permalink
Add test for padded object block parser
Browse files Browse the repository at this point in the history
  • Loading branch information
SRv6d committed Oct 5, 2024
1 parent 8e0c88a commit d77d053
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/parser/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,29 @@ mod tests {
assert!(parser.parse_next(object).is_err());
}

#[rstest]
#[case(
&mut concat!(
"\n\n",
"email: [email protected]\n",
"nic-hdl: RPSL1-RIPE\n",
"\n",
"\n\n\n"
),
vec![
Attribute::unchecked_single("email", "[email protected]"),
Attribute::unchecked_single("nic-hdl", "RPSL1-RIPE")
]
)]
fn object_block_padded_valid(#[case] given: &mut &str, #[case] attributes: Vec<Attribute>) {
let expected = Object::from_parsed(given, attributes);

let mut parser = object_block_padded::<_, ContextError>(object_block());
let parsed = parser.parse_next(given).unwrap();

assert_eq!(parsed, expected);
}

#[rstest]
#[case(
&mut "% Note: This is a server message\n"
Expand Down

0 comments on commit d77d053

Please sign in to comment.