Skip to content

Test classes with compilation errors pass #90

@Ovid

Description

@Ovid

This is Test::Class::Moose version 0.91.

On a number of occasions we've found that our test classes have a syntax error and are skipped, but the test passes. Below is an example:

#!/usr/bin/env perl

use strict;
use warnings;

use Test::Class::Moose::Runner;

eval <<'END_CLASS';
package BadClass {
    use Test::Class::Moose;

    sub test_something {
        ok $undeclared_variable, 'You shall not pass';
    }
}
END_CLASS
eval <<'END_CLASS';
package GoodClass {
    use Test::Class::Moose;

    sub test_something_else {
        ok 1, 'OK, you can pass';
    }
}
END_CLASS

my $runner = Test::Class::Moose::Runner->new;
$runner->runtests;

And when you run that:

tcm.t ..
1..2
ok 1 - BadClass {
    1..0 # SKIP Skipping 'BadClass': no test methods found
}
ok 2 - GoodClass {
    1..1
    ok 1 - test_something_else {
        ok 1 - OK, you can pass
        1..1
    }
}
ok
All tests successful.
Files=1, Tests=2,  1 wallclock secs ( 0.01 usr  0.00 sys +  0.25 cusr  0.02 csys =  0.28 CPU)
Result: PASS

I suspect this may have the same underlying issue as #70.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions