Skip to content

Commit

Permalink
More modular rfc3966 test
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Jul 7, 2024
1 parent 4384852 commit 5be48f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/prop.proptest-regressions
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc b429ed298cc9cdf5ac50cf41cc9bf7819a00f9a8f8f3dab37240e6f4c7f13c88 # shrinks to s = "-;phone-context=Σ"
cc d2e7fadc2dd4bf597d2ba7e5079c5b0e0d53beab84b45fba0b598226514aa3a3 # shrinks to s = "+3a;phone-context=AAa0a"
cc f4f1a19cf143c767508ab557480843e4f4093898768fbbea1034d19d4308257d # shrinks to tel_prefix = false, use_plus = true, s = "da", phone_context = Some("A0A0a")
cc 4ea103e574793bd24b0267cc8a80962299ee50746d69332fbd0b85532fb707e2 # shrinks to tel_prefix = false, use_plus = false, s = "0", phone_context = Some("প")
11 changes: 10 additions & 1 deletion tests/prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ use proptest::prelude::*;

proptest! {
#[test]
fn rfc3966_crash_test(s in "(tel:)?.*;phone-context=\\PC*") {
fn rfc3966_crash_test(
tel_prefix: bool,
use_plus: bool,
s: String,
phone_context: Option<String>,
) {
let context = if let Some(phone_context) = &phone_context { format!(";phone-context={phone_context}") } else { "".to_string() };
let tel_prefix = if tel_prefix { "tel:" } else { "" };
let plus = if use_plus { "+" } else { "" };
let s = format!("{}{}{}{}", tel_prefix, plus, s, context);
let _ = parse(None, &s);
}

Expand Down

0 comments on commit 5be48f0

Please sign in to comment.