App-Test-Generator

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- SchemaExtractor now parses =head3 Input and =head4 Input formal spec
	  blocks, mirroring the existing =head4 Output support. Positional array
	  format ([ {type=>'...'}, ... ]) and named hash format
	  ({ name => {type=>'...'}, ... }) are both supported. The spec takes
	  highest priority, overriding all heuristic type inference. Union types
	  such as 'scalar | scalarref' are resolved to the canonical ATG type
	  (both scalar and scalarref map to string).
	- Add t/app.t: ATG self-test that runs every lib/**/*.pm through
	  SchemaExtractor (strict_pod=fatal), generates a fuzz harness for each
	  extracted schema via App::Test::Generator, and runs it through prove.
	  Temp dirs containing the intermediate schema YAML and generated .t files
	  are kept on failure for diagnosis. Runs as an extended test.
	- Support array-returning methods end-to-end, enabled by Test::Returns 0.03
	  which accepts type => 'array' as a synonym for type => 'arrayref':
	  extract-schemas now emits output.type: array for list-returning methods,
	  the output-type validator accepts 'array' as a valid type, and generated
	  tests capture the result in list context (my @_r = CALL; $result = \@_r)
	  so that returns_ok can validate it as an arrayref.
	- Fix strict_pod=fatal incorrectly flagging methods with no POD at all;
	  the check now only runs when POD is present (validates accuracy of
	  existing documentation, not completeness).
	- Fix strict_pod=fatal false positive: $class and $self are always treated
	  as invocants and never reported as undocumented code parameters,
	  regardless of method name.
	- Fix _extract_pod_before accumulating multiple adjacent POD blocks; it
	  now stops after the first pod token so class-level POD separated by
	  =cut does not bleed into a method's specific POD context.
	- Fix generated tests dying without done_testing() when an input parameter
	  has type arrayref or array; both types are now handled in the mandatory-
	  argument setup block in Template.pm.
	- Fix extract-schemas creating spurious schema files for Perl special blocks
	  (BEGIN, END, DESTROY, AUTOLOAD, CHECK, INIT, UNITCHECK); these are now
	  skipped in _find_methods.
	- Fix extract-schemas failing to emit new: ~ for instance methods that use
	  the my $self = $_[0] direct-index invocant style and call other instance
	  methods via $self->method() but do not dereference $self directly;
	  _detect_instance_method now recognises $_[0] as explicit_self (high
	  confidence), and _needs_object_instantiation now promotes methods that
	  call instance methods on $self even when no hash/array dereference is
	  present.
	- Fix --strict-pod false positive for methods using the my $self = $_[0]
	  calling style: add direct-index style recognition to
	  _extract_parameters_from_signature and guard the fallback extractor in
	  _extract_defaults_from_code so that inner closure parameters
	  (my ($x, $y) = @_ inside a sub ref) are not mistaken for the outer
	  method's parameters.

	[Bug fixes]
	- Fix Mutation::NumericBoundary's conditional-context detection
	  (used for Mutator's fast-mode dedup) always evaluating false: PPI
	  wraps a condition's content in PPI::Statement::Expression, so an
	  operator's immediate parent is never literally
	  PPI::Structure::Condition. Operators inside if/unless/while/until
	  conditions were always tagged 'expression'. Now uses the same
	  ancestor-walking _in_conditional() helper already shared by
	  BooleanNegation and ReturnUndef.
	- Fix Analyzer::SideEffect.pm's mutates_self and mutates_globals
	  detection ($self->{field} = ... assignment and %ENV/%SIG/@ARGV
	  mutation) matching against the raw method body instead of the
	  comment/string-stripped $code_only, so a field-assignment-like
	  fragment inside a string literal or comment could be mistaken for
	  an actual mutation. Both checks now match against $code_only, same
	  as the keyword/operator counts already fixed in a prior release.
	- Fix Emitter::Perl.pm's _emit_method_tests() having no dispatch
	  branch for the boundary_tests plan flag: TestStrategy.pm sets
	  $plan{boundary_tests} when a method's schema carries non-empty
	  _yamltest_hints, but the corresponding $TEST_BOUNDARY constant was
	  defined and never read, so methods planned for boundary testing
	  silently got zero generated test code for it. Added the dispatch
	  line plus a new _emit_boundary_test() that emits one smoke-test
	  block per boundary_values/invalid_inputs hint value.
	- Fix TestStrategy.pm's generate_plan() extracting side_effects and
	  dependencies from each method's schema _analysis but never using
	  them, while the module's own DESCRIPTION claimed the plan was
	  based on them; verified empirically that schema side-effect data
	  has zero effect on the generated plan. Removed the dead
	  extraction and corrected DESCRIPTION to attribute side-effect- and
	  dependency-driven planning to Planner::Mock and Planner::Isolation,
	  where it actually happens.
	- Fix SchemaExtractor.pm's include_private POD describing the
	  always-included _new/_init/_build method-name override as an
	  exact-name match; _find_methods actually does a prefix match
	  (/^_(new|init|build)/), so e.g. _build_attribute and _init_logger
	  are also force-included, matching common Moose builder/
	  initializer naming conventions. Confirmed via git log -L that the
	  prefix behaviour is original and deliberate; POD corrected to
	  match.
	- Fix Generator.pm's render_hash() POD describing $href's values as
	  always hashrefs; a scalar value that is a recognised type string
	  is silently expanded to { type => $value } before being skipped-
	  with-a-warning, which the POD did not mention.
	- Fix Generator.pm's _perl_quote() POD omitting that the strings
	  'true'/'false' are special-cased to the Perl boolean constants
	  !!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,
	  t/Template_unit.t) already exercised its public API exhaustively
	  in equivalent black-box style, no duplicate coverage was added to
	  t/unit.t.
	- Add missing public-API POD (Purpose, Arguments, Returns, API
	  specification) to every previously undocumented public method in
	  Model::Method.pm, which had none beyond a VERSION section; to
	  Template.pm's get_data_section(); and to Planner.pm's build_plan(),



( run in 0.535 second using v1.01-cache-2.11-cpan-b16cb0d3907 )