Skip to content

Commit

Permalink
Use string regex within attribute value strategy to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
SRv6d committed Dec 14, 2023
1 parent ae93322 commit c14e90c
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions tests/test_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,7 @@ mod strategies {
/// An attrbute value may consist of any ASCII characters excluding control and

Check failure on line 30 in tests/test_parsing.rs

View workflow job for this annotation

GitHub Actions / spellcheck

attrbute ==> attribute
/// must not start with, or consist entirely of whitespace.
fn attribute_value_content() -> impl Strategy<Value = String> {
(
prop_oneof![
proptest::char::ranges(['0'..='9'].as_slice().into()),
proptest::char::ranges(['a'..='z', 'A'..='Z'].as_slice().into()),
proptest::char::ranges(
['!'..='/', ':'..='@', '['..='`', '{'..='~']
.as_slice()
.into()
)
],
proptest::collection::vec(
prop_oneof![
Just(' '),
proptest::char::ranges(['0'..='9'].as_slice().into()),
proptest::char::ranges(['a'..='z', 'A'..='Z'].as_slice().into()),
proptest::char::ranges(
['!'..='/', ':'..='@', '['..='`', '{'..='~']
.as_slice()
.into()
)
],
1..250,
),
)
.prop_map(|(first, rest)| std::iter::once(first).chain(rest).collect())
proptest::string::string_regex("[!-~][ -~]*").unwrap()
}

/// An empty attribute value.
Expand Down

0 comments on commit c14e90c

Please sign in to comment.