App-Test-Generator
view release on metacpan or search on metacpan
t/function.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::Most;
use Test::Mockingbird;
use Test::Returns;
use Test::Memory::Cycle;
use Capture::Tiny qw(capture_stdout capture_merged);
use File::Temp qw(tempdir tempfile);
use File::Spec;
use File::Path qw(make_path);
use Cwd qw(getcwd);
use Carp qw(croak);
use JSON::MaybeXS qw(decode_json);
use PPI;
use Readonly;
use Scalar::Util qw(looks_like_number);
# CORE::GLOBAL::system overrides are resolved when the *calling* code is
# compiled, not dispatched dynamically -- a "local *CORE::GLOBAL::system"
# set at runtime inside a subtest has no effect on Mutator::run_tests(),
# because Mutator.pm is already compiled by the time that subtest runs.
# This override must therefore be installed in a BEGIN block before
# App::Test::Generator::Mutator is use'd below, with the actual mock
# behaviour supplied per-subtest via $REAL_SYSTEM_HOOK so the default
# (no active subtest) passes through to the real builtin.
our $REAL_SYSTEM_HOOK;
BEGIN {
no warnings 'redefine';
*CORE::GLOBAL::system = sub {
return $REAL_SYSTEM_HOOK ? $REAL_SYSTEM_HOOK->(@_) : CORE::system(@_);
};
}
# Allow access to private helpers via the package namespace
BEGIN {
use_ok('App::Test::Generator');
use_ok('App::Test::Generator::Mutator');
use_ok('App::Test::Generator::Mutant');
use_ok('App::Test::Generator::Exporter::YAML');
use_ok('App::Test::Generator::Analyzer::Return');
use_ok('App::Test::Generator::Analyzer::ReturnMeta');
use_ok('App::Test::Generator::Analyzer::Complexity');
use_ok('App::Test::Generator::Analyzer::SideEffect');
use_ok('App::Test::Generator::Planner::Mock');
use_ok('App::Test::Generator::Planner::Fixture');
use_ok('App::Test::Generator::Planner::Grouping');
use_ok('App::Test::Generator::Planner::Isolation');
use_ok('App::Test::Generator::Planner');
use_ok('App::Test::Generator::LCSAJ::Coverage');
use_ok('App::Test::Generator::LCSAJ');
use_ok('App::Test::Generator::Mutation::Base');
use_ok('App::Test::Generator::Mutation::ConditionalInversion');
use_ok('App::Test::Generator::Mutation::NumericBoundary');
use_ok('App::Test::Generator::Mutation::ReturnUndef');
use_ok('App::Test::Generator::Mutation::BooleanNegation');
use_ok('App::Test::Generator::TestStrategy');
use_ok('App::Test::Generator::Model::Method');
use_ok('App::Test::Generator::Sample::Module');
use_ok('Devel::App::Test::Generator::LCSAJ::Runtime');
use_ok('App::Test::Generator::Emitter::Perl');
use_ok('App::Test::Generator::Template');
use_ok('App::Test::Generator::SchemaExtractor');
}
# --------------------------------------------------
# Constants used across multiple subtests to avoid
# magic literals and make intent clear
# --------------------------------------------------
Readonly my $EMPTY_STRING => '';
Readonly my $UNDEF_LITERAL => 'undef';
# --------------------------------------------------
# Mirrors of the boundary constants private to
# App::Test::Generator::Sample::Module, so its
# boundary tests below avoid magic numbers without
# requiring the module to export its internals
( run in 0.559 second using v1.01-cache-2.11-cpan-6aa56a78535 )