/usr/share/perl5/Test/Unit/Test.pm is in libtest-unit-perl 0.25-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | package Test::Unit::Test;
use strict;
use Carp;
use Test::Unit::Debug qw(debug);
use base qw(Test::Unit::Assert);
sub count_test_cases {
my $self = shift;
my $class = ref($self);
croak "call to abstract method ${class}::count_test_cases";
}
sub run {
my $self = shift;
my $class = ref($self);
croak "call to abstract method ${class}::run";
}
sub name {
my $self = shift;
my $class = ref($self);
croak "call to abstract method ${class}::name";
}
sub to_string {
my $self = shift;
return $self->name();
}
sub filter_method {
my $self = shift;
my ($token) = @_;
my $filtered = $self->filter->{$token};
return unless $filtered;
if (ref $filtered eq 'ARRAY') {
return grep $self->name eq $_, @$filtered;
}
elsif (ref $filtered eq 'CODE') {
return $filtered->($self->name);
}
else {
die "Didn't understand filtering definition for token $token in ",
ref($self), "\n";
}
}
my %filter = ();
sub filter { \%filter }
# use Attribute::Handlers;
# sub Filter : ATTR(CODE) {
# my ($pkg, $symbol, $referent, $attr, $data, $phase) = @_;
# print "attr $attr (data $data) on $pkg\::*{$symbol}{NAME}\n";
# # return ();
# }
sub _find_sym { # pinched from Attribute::Handlers
my ($pkg, $ref) = @_;
my $type = ref($ref);
no strict 'refs';
warn "type $type\n";
while (my ($name, $sym) = each %{$pkg."::"} ) {
use Data::Dumper;
# warn Dumper(*$sym);
warn "name $name sym $sym (" . (*{$sym}{$type} || '?') . ") matches?\n";
return \$sym if *{$sym}{$type} && *{$sym}{$type} == $ref;
}
}
sub MODIFY_CODE_ATTRIBUTES {
my ($pkg, $subref, @attrs) = @_;
my @bad = ();
foreach my $attr (@attrs) {
if ($attr =~ /^Filter\((.*)\)$/) {
my @tokens = split /\s+|\s*,\s*/, $1;
my $sym = _find_sym($pkg, $subref);
if ($sym) {
push @{ $filter{$_} }, *{$sym}{NAME} foreach @tokens;
}
else {
warn "Couldn't find symbol for $subref in $pkg\n" unless $sym;
push @bad, $attr;
}
}
else {
push @bad, $attr;
}
}
return @bad;
}
1;
__END__
=head1 NAME
Test::Unit::Test - unit testing framework abstract base class
=head1 SYNOPSIS
This class is not intended to be used directly
=head1 DESCRIPTION
This class is used by the framework to define the interface of a test.
It is an abstract base class implemented by Test::Unit::TestCase and
Test::Unit::TestSuite.
Due to the nature of the Perl OO implementation, this class is not
really needed, but rather serves as documentation of the interface.
=head1 AUTHOR
Copyright (c) 2000-2002, 2005 the PerlUnit Development Team
(see L<Test::Unit> or the F<AUTHORS> file included in this
distribution).
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.
=head1 SEE ALSO
=over 4
=item *
L<Test::Unit::Assert>
=item *
L<Test::Unit::TestCase>
=item *
L<Test::Unit::TestSuite>
=back
=cut
|