1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#! /usr/bin/perl -T
use strict;
use warnings;
package Foo;
use Test::More;
use base qw(Test::Class);
sub set_tests : Test(1) {
pass("this should pass");
};
sub undef_tests : Test(no_plan) {
my $self = shift;
my $n = $self->{runtime_tests};
foreach $n (1..$n) {
pass("runtime test $n");
};
};
package main;
use Test::More;
use Test::Exception;
my $foo = Foo->new;
$foo->{runtime_tests} = 2;
$foo->runtests;
my $expected = $foo->{runtime_tests} + 1;
my $ran = $foo->builder->current_test;
is($ran, $expected, "expected number of tests ran");
|