Expand description
Property-based test generators for Perl domain objects.
This crate provides reusable [proptest::Strategy] implementations for
generating Perl variables, module paths, code snippets, and Unicode
strings suitable for fuzzing parsers and LSP components.
§Example
use proptest::prelude::*;
use perl_test_generators::{variable, module_path, non_empty_unicode_string};
proptest! {
#[test]
fn vars_parse(sym in variable()) {
assert!(sym.starts_with('$') || sym.starts_with('@') || sym.starts_with('%'));
}
#[test]
fn non_empty_text(text in non_empty_unicode_string()) {
assert!(!text.is_empty());
}
}Functions§
- integer_
literal - Generate a non-negative integer literal.
- module_
path - Generate a full module path (1–5 segments joined by
::). - module_
path_ segments - Generate module path segments as a
Vec<String>. - non_
empty_ unicode_ string - Generate a non-empty Unicode string.
- perl_
identifier - Generate a plain ASCII Perl identifier without a sigil.
- scalar_
variable - Generate a scalar variable name such as
$value. - simple_
expression - Generate a small expression that should be valid Perl syntax.
- simple_
program - Generate a small Perl program made from conservative statement forms.
- simple_
statement - Generate a simple statement that should be valid Perl syntax.
- single_
quoted_ string_ literal - Generate a simple single-quoted string literal.
- unicode_
string - Generate a Unicode string suitable for testing UTF-8/UTF-16 conversion.
- variable
- Generate a full Perl variable name including sigil.