Perl-PrereqScanner-NotQuiteLite

 view release on metacpan or  search on metacpan

xt/snippets/test_snippets.t  view on Meta::CPAN

    mixin
    module_runtime
    mojo_base
    moosex_declare
    moose/any_moose
    moose/class_accessor
    moose/extends_inner_package
    moose/moose
    moose/no_moose
    moose/todo
    moose/with_variable
    object_pad/attr
    object_pad/basic
    object_pad/feature_compat_class
    object_pad/isa_and_does
    only
    package_variant
    plack
    prefork
    syntax_collector
    test_class_most
    test_more
    test_requires
    universal_version
    unless
);

my %testing = map { $_ => 1 } qw(
);

my %skip = map { $_ => 1 } qw(
    00_load
    inline
);

find({
        wanted => sub {
            my $file = $File::Find::name;
            return unless -f $file && $file =~ /\.t$/;
            return if $file =~ m!t/(?:app|bin|compat|scan)!;
            my ($basename) = $file =~ m!\bt/(.+?)\.t$!;
            return if $skip{$basename};    # TODO: needs finer control
            if (!$ENV{TEST_VERBOSE} && $ok{$basename}) {
                pass $basename;
                return;
            }
            return if $ENV{TEST_ONLY} && $ENV{TEST_ONLY} ne $basename;
            subtest "$basename" => sub {
                open my $fh, '<', $file;
                my $flag;
                my $code       = '';
                my $test_count = 1;
                my $expected;
                my $expected_nothing;
                my $skip;

                while (<$fh>) {
                    if ($flag) {
                        if (/^END$/) {
                            my $tmp = File::Temp->new(DIR => "$FindBin::Bin/local", UNLINK => 0);
                            print $tmp "use feature ':all';\n" unless $basename eq 'minimum_version';
                            print $tmp "$code\n;\n1;";
                            my $filename = $tmp->filename;
                            close $tmp;
                            note "TEST CODE:" . "-" x 30 . "\n$code\n" . "-" x 40 . "\n\n";
                            my $result = `$^X -I$local/$basename/lib/perl5 -c $filename 2>&1`;
                        SKIP: {
                                skip $skip, 1 if $skip;
                                if ($expected_nothing) {
                                    ok !$result, "$file: expected nothing" or note "RESULT: $result";
                                } elsif ($expected) {
                                    # probably an erroneous output
                                    ok $result =~ /$expected/, "$file: expected result" or note "RESULT: $result";
                                } else {
                                    ok $result =~ /syntax OK/, "$file: test $test_count" or note "RESULT: $result";
                                }
                            }
                            $flag = 0;
                            $test_count++;
                            $code = $expected = $expected_nothing = $skip = '';
                        } else {
                            $code .= $_;
                        }
                    } else {

                        last if /^done_testing/;
                        if (/^#SKIP: (.*)$/) {
                            $skip = $1;
                            next;
                        }
                        if (/^#SKIP_IF: (.*)$/) {
                            my $condition = $1;
                            $skip = $condition if eval $condition;
                            next;
                        }
                        if (/^#SKIP_ALL_IF: (.*)$/) {
                            my $condition = $1;
                            if (eval $condition) {
                            TODO: {
                                    local $TODO = $condition;
                                    fail "skipped";
                                }
                                return;
                            }
                            next;
                        }
                        if (/^#EXPECTED: (.*)$/) {
                            $expected = $1;
                            next;
                        }
                        if (/^#EXPECTED_NOTHING$/) {
                            $expected_nothing = 1;
                            next;
                        }
                        if (/^#EXPECTED_NOTHING_IF: (.*)$/) {
                            my $condition = $1;
                            $expected_nothing = 1 if eval $condition;
                            next;
                        }
                        if (/^#REQUIRES: (.*)$/) {
                            my $module = $1;



( run in 2.955 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )