1use crate::{SmartString, SmartStringMode};
8use proptest::proptest;
9use proptest::strategy::{BoxedStrategy, Strategy};
10use proptest::string::Error;
11
12pub fn string_regex<Mode: SmartStringMode>(
16 regex: &str,
17) -> Result<BoxedStrategy<SmartString<Mode>>, Error>
18where
19 Mode: 'static,
20{
21 proptest::string::string_regex(regex).map(|g| g.prop_map(SmartString::from).boxed())
22}
23
24proptest! {
25 #[test]
26 fn strategy(string in string_regex(".+").unwrap()) {
27 assert!(!SmartString::<crate::LazyCompact>::is_empty(&string));
28 }
29}