From 97ea70cbae745d9b1402442a94b2ed1c29b50c3d Mon Sep 17 00:00:00 2001 From: Marvin Vogt Date: Sat, 28 Sep 2024 13:19:55 +0200 Subject: [PATCH] Add test to ensure non extended ASCII values are not parsed in value --- src/parser/component.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/parser/component.rs b/src/parser/component.rs index 912689e..1dfc1dd 100644 --- a/src/parser/component.rs +++ b/src/parser/component.rs @@ -80,6 +80,7 @@ pub fn consume_continuation_char(input: &mut &str) -> PResult<()> { #[cfg(test)] mod tests { + use proptest::prelude::*; use rstest::*; use super::*; @@ -225,6 +226,15 @@ mod tests { assert_eq!(*given, remaining); } + proptest! { + /// Any non extended ASCII is not returned by the value parser. + #[test] + fn attribute_value_non_extended_ascii_not_parsed(s in r"[^\x00-\xFF]+") { + let parsed = attribute_value(&mut s.as_str()).unwrap(); + prop_assert_eq!(parsed, ""); + } + } + #[rstest] #[case( &mut " continuation value prefixed by a space\n",