Skip to main content

Crate perl_test_generators

Crate perl_test_generators 

Source
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.