perl_test_generators/code/
literals.rs1use proptest::prelude::*;
2
3use super::chars::ascii_alphanumeric_or_underscore;
4
5pub fn integer_literal() -> impl Strategy<Value = String> {
7 (0_u32..=9999).prop_map(|value| value.to_string())
8}
9
10pub fn single_quoted_string_literal() -> impl Strategy<Value = String> {
12 prop::collection::vec(
13 prop_oneof![ascii_alphanumeric_or_underscore(), Just(' '), Just('-')],
14 0..=16_usize,
15 )
16 .prop_map(|chars| {
17 let body: String = chars.into_iter().collect();
18 format!("'{body}'")
19 })
20}