perl_test_generators/code/
identifiers.rs1use proptest::prelude::*;
2
3use super::chars::{ascii_alphanumeric_or_underscore, ascii_letter_or_underscore};
4
5pub fn perl_identifier() -> impl Strategy<Value = String> {
7 (
8 ascii_letter_or_underscore(),
9 prop::collection::vec(ascii_alphanumeric_or_underscore(), 0..=10_usize),
10 )
11 .prop_map(|(first, rest)| std::iter::once(first).chain(rest).collect())
12}
13
14pub fn scalar_variable() -> impl Strategy<Value = String> {
16 perl_identifier().prop_map(|name| format!("${name}"))
17}