App-Test-Generator
view release on metacpan or search on metacpan
bin/fuzz-harness-generator view on Meta::CPAN
my @corpus_files = _collect_corpus_files($replay_corpus);
die "No corpus JSON files found at: $replay_corpus\n" unless @corpus_files;
my $tap = _generate_replay_tap(@corpus_files);
if($outfile) {
open(my $fh, '>', $outfile)
or die "Cannot write to $outfile: $!";
print $fh $tap;
close $fh;
chmod 0755, $outfile;
print "Replay test written to: $outfile\n";
if($run) {
exit system('prove', '-l', $outfile) >> 8;
}
} else {
print $tap;
}
exit 0;
}
bin/fuzz-harness-generator view on Meta::CPAN
unlink $tmp;
print "Dry-run OK: $infile parsed and validated successfully\n";
exit 0;
} elsif($outfile && -e $outfile && !$run) {
warn "Overwriting existing file: $outfile";
}
App::Test::Generator->generate($infile, $outfile);
if($outfile) {
chmod 0755, $outfile if($outfile =~ /\.(pl|cgi)$/);
if($run) {
# Use list form to avoid shell interpolation of $outfile
system('prove', '-l', $outfile);
}
}
exit 0;
# ---------------------------------------------------------------------------
# Helpers for --replay-corpus
doc/SchemaExtractor.pm view on Meta::CPAN
cpanm Pod::Simple
cpanm YAML::XS
```
### Install the Module
```bash
# Copy files to your project
cp SchemaExtractor.pm lib/App/Test/Generator/
cp extract-schemas bin/
chmod +x bin/extract-schemas
```
## Quick Start
### 1. Extract schemas from a module
```bash
perl bin/extract-schemas lib/MyModule.pm
```
lib/App/Test/Generator.pm view on Meta::CPAN
# Entry: $name - the string to check.
# Exit: Returns 1 if builtin, 0 otherwise.
# Side effects: None.
# --------------------------------------------------
sub _is_perl_builtin {
my $name = $_[0];
return 0 unless defined $name;
state %BUILTINS = map { $_ => 1 } qw(
abs accept alarm atan2 bind binmode bless
caller chdir chmod chomp chop chown chr chroot
close closedir connect cos crypt
dbmclose dbmopen defined delete die do dump
each endgrent endhostent endnetent endprotoent endpwent endservent
eof eval exec exists exit exp
fcntl fileno flock fork format formline
getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname
gethostent getlogin getnetbyaddr getnetbyname getnetent
getpeername getpgrp getppid getpriority getprotobyname
getprotobynumber getprotoent getpwent getpwnam getpwuid
getservbyname getservbyport getservent getsockname getsockopt
t/edge_cases.t view on Meta::CPAN
my $tmpdir = tempdir(CLEANUP => 1);
my $pm = File::Spec->catfile($tmpdir, 'Foo.pm');
open my $fh, '>', $pm or die $!;
print $fh "package Foo;\nsub bar { return 1; }\n1;\n";
close $fh;
SKIP: {
skip 'running as root', 1 if $> == 0;
my $no_write = File::Spec->catdir($tmpdir, 'no_write');
mkdir $no_write or die $!;
chmod 0444, $no_write;
throws_ok(
sub { App::Test::Generator::LCSAJ->generate($pm, $no_write) },
qr/Cannot|write|permission/i,
'unwritable output dir croaks',
);
chmod 0755, $no_write;
}
};
# ==================================================================
# Planner â boundary and pathological inputs
# ==================================================================
subtest 'Planner: empty schemas produces empty plan' => sub {
my $p = App::Test::Generator::Planner->new(
schemas => {},
( run in 0.602 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )