App-Test-Generator

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- Fix mutation dashboard Total column excluding skipped mutants; Total now
	  equals Killed + Survivors + Skipped. Score remains based on Killed / (Killed
	  + Survivors) so skipped mutants do not penalise the mutation score.
	- Fix extract-schemas --strict-pod false positive when a method uses
	  Params::Get::get_params('key', \@_) to extract arguments; the key name
	  is now recognised as a code parameter, resolving POD/code disagreement.
	- Fix _extract_defaults_from_code incorrectly marking a parameter as
	  optional when its only assignment is a dereference or method call
	  (e.g. my $x = $params->{x}); such expressions are not default values.
	- Fix extract-schemas inferring output type as string instead of hashref
	  when a method has a =head4 Output formal spec; the spec type now takes
	  precedence over heuristic code analysis (the string came from scalar
	  being mapped to string when it wasn't in the valid-types list).
	- Fix extract-schemas inferring output type as string instead of array when
	  a =head4 Output block uses list notation (...); the output-type validator
	  did not include 'array' in its allowed-types set and silently fell back
	  to string.
	- Fix SchemaExtractor emitting both 'enum' and 'memberof' for the same
	  parameter when a regex-based enum is detected; the two fields are mutually
	  exclusive and Generator.pm now rejects schemas that contain both.
	  SchemaExtractor now only sets memberof when enum is not already being
	  output in the cleaned schema.
	- Fix SchemaExtractor falsely inferring type 'number' for parameters whose
	  code uses the defined-or operator (//) — e.g. $text // '' was mistaken
	  for division because the numeric-operator pattern included bare / without
	  excluding //. Both heuristic-inference sites now use \/(?!\/) to require
	  that the / is not followed by a second /.

	[Enhancements]
	- 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



( run in 1.030 second using v1.01-cache-2.11-cpan-5fbc6bb55f2 )