App-Test-Generator
view release on metacpan or search on metacpan
plan() actually returns a per-method hashref with a 'fixture' key
(plus optional env/filesystem/time/network keys), not a bare mode
string, so the comparison always stringified a hash reference and
was always false. In practice this meant every method planned by
Planner::build_plan() silently got 'new_per_test' fixture mode,
even purity-'pure' methods that should have gotten a shared
fixture. Each module's own unit tests passed because they fed
Fixture::plan() a fabricated flat-string isolation map that never
matched Isolation::plan()'s real output shape; only composing the
two through build_plan() in a new end-to-end test caught the
mismatch. Fixed to read $isolation->{$method}{fixture}; updated
Fixture.pm's POD and t/Planner-Fixture.t, t/Planner-submodules_unit.t,
and t/function.t's fixtures to the real per-method hashref shape.
- Fix mutation.json incorrectly added to .gitignore while the file is
tracked by git; removed the .gitignore entry and untracked the file
with git rm --cached so it is no longer committed.
- Fix mutate.yml (deployed to dependent repos) still using floating
shogo82148/actions-setup-perl@v1 after dashboard.yml was pinned;
both deployed workflow files now pin to the same version.
- Fix POD-embedded CI workflow template referencing stale action
versions (actions/checkout@v5, actions-setup-perl@v1) after
dashboard.yml was updated; template now matches dashboard.yml.
- Fix README.md SEE ALSO link label still saying "Test Coverage Report"
after the POD was updated to "Test Dashboard".
- Fix dashboard.yml "Publish test dashboard" step running unguarded on
pull_request events, publishing PR-derived coverage output to the
public gh-pages site; now skipped on pull_request like the other
commit steps.
- Fix dashboard.yml "Save updated mutation results" guard
(if: github.event_name == 'workflow_run') discarding the freshly
regenerated mutation.json on plain push runs; generate-test-dashboard
regenerates mutation.json on every run regardless of trigger, so the
guard now matches its siblings (if: github.event_name !=
'pull_request').
- Fix dashboard.yml silently skipping the coverage snapshot when
cover_html/cover.json is missing, masking real dashboard-generation
failures; the step now emits an ::error:: annotation, dumps
cover_db/cover_html/coverage for diagnosis, and fails the job.
- Fix mutate.yml "Find last code commit" silently falling back to
!!1/!!0 rather than being single-quoted like other strings.
- Fix Analyzer::Complexity.pm and Analyzer::Return.pm POD describing
their $method argument as an App::Test::Generator::Model::Method
object; SchemaExtractor's actual callers pass a plain hashref with
a body/source key, not a Model::Method instance. POD corrected to
describe the real calling convention.
- Fix README.md's extract-schemas usage example passing two
positional arguments and referencing a nonexistent
lib/Sample/Module.pm with a .yaml extension; corrected to the real
invocation (extract-schemas lib/App/Test/Generator/Sample/Module.pm
&& fuzz-harness-generator -r schemas/greet.yml) and updated its
GitHub Actions example to the same pinned action SHAs already used
in dashboard.yml/mutate.yml.
[Enhancements]
- Add comprehensive black-box subtests to t/unit.t validating the
public, POD-documented API of every .pm file under lib/ (all 27
modules), written strictly against each module's documented
Arguments/Returns contract rather than incidental implementation
behaviour. Where a module's existing dedicated test file
(e.g. t/Planner-Isolation.t, t/TestStrategy.t,
one stub listing all variants â one good test kills them all.
Boundary value suggestions are generated for numeric mutations,
clamped and deduplicated for non-negative contexts such as
scalar() and length(). Environment variable hints are added where
the source line references $ENV{...}. The enclosing subroutine
name is shown in each stub for navigation context. File is skipped
if there are no survivors or low-difficulty hints to report.
- LCSAJ path dots on per-file mutation pages are now coloured blue
(covered) or red (not covered), based on whether any line in the
path range was executed during testing. Uncovered paths show
[NOT COVERED] in the hover tooltip. The LCSAJ legend is updated
to explain both colours.
- Replaced TER3-only column in mutation files table with a
TER1 / TER2 / TER3 triple, each component shown as a
colour-coded badge (green/yellow/red). TER1=Statement,
TER2=Branch, TER3=LCSAJ path coverage. Any component
without data shows a grey n/a badge. Column header carries
a tooltip defining all three metrics.
- Added --generate_test=mutant option to generate_index.pl (used
alongside --generate_mutant_tests=DIR). For NUM_BOUNDARY survivors,
attempts to produce a runnable YAML schema file in t/conf/ using
bin/test-generator-index view on Meta::CPAN
if(/our\s+\$VERSION\s*=\s*['"]([^'"]+)['"]/) {
$atg_version = $1;
last;
}
}
close $fh;
}
push @html, '<footer>',
"\t<p>Project: <a href=\"https://github.com/$config{github_user}/$config{github_repo}\">$config{github_repo}</a></p>",
"\t<p><em>Last updated: $timestamp - <a href=\"$commit_url\">commit <code>$short_sha</code></a></em></p>",
"\t<p style=\"float: right; font-size: 0.85em; color: #999;\">Powered by <a href=\"https://metacpan.org/dist/App-Test-Generator\">App::Test::Generator $atg_version</a></p>",
'</footer>';
push @html, '</body>', '</html>';
# Write to index.html
print "Writing output to $config{output}\n" if($config{verbose});
write_file($config{output}, join("\n", @html));
# Generate mutant test stubs only if --generate_mutant_tests=dir was given.
lib/App/Test/Generator/SchemaExtractor.pm view on Meta::CPAN
# $self.
#
# Exit: Returns nothing. Modifies $params
# in place.
#
# Side effects: Logs detections to stdout when
# verbose is set.
#
# Notes: Eight default patterns are tried.
# Only parameters already present in
# $params are updated â this method
# does not add new parameters.
# Falls back to extracting all @_
# assignments if $params is empty
# after the main pass.
# --------------------------------------------------
sub _extract_defaults_from_code {
my ($self, $params, $code, $method) = @_;
# Pattern 1: my $param = value;
while ($code =~ /my\s+\$(\w+)\s*=\s*([^;]+);/g) {
t/Mutation-BooleanNegation.t view on Meta::CPAN
# ==================================================================
# NOTE: API improvement opportunity
# --------------------------------------------------
# The mutate() method currently returns a flat list which is copied
# onto the caller's stack. For large documents with many return
# statements this wastes memory. The method should return an arrayref:
#
# return \@mutants;
#
# and callers updated to dereference:
#
# my @mutants = @{ $mutation->mutate($doc) };
#
# This applies to all Mutation::* subclasses for consistency.
# The same change should be made to ReturnUndef, NumericBoundary,
# and ConditionalInversion at the same time.
# ==================================================================
done_testing();
( run in 0.410 second using v1.01-cache-2.11-cpan-bbe5e583499 )