/usr/share/perl5/Test/Name/FromLine.pm is in libtest-name-fromline-perl 0.13-1.
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 | package Test::Name::FromLine;
use strict;
use warnings;
our $VERSION = '0.13';
use Test::Builder;
use File::Slurp;
use File::Spec;
use Cwd qw(getcwd);
our $BASE_DIR = getcwd();
our %filecache;
no warnings 'redefine';
my $ORIGINAL_ok = \&Test::Builder::ok;
*Test::Builder::ok = sub {
@_ = @_; # for pass and fail
$_[2] = do {
my ($package, $filename, $line) = caller($Test::Builder::Level);
undef $filename if $filename && $filename eq '-e';
if ($filename) {
$filename = File::Spec->rel2abs($filename, $BASE_DIR);
my $file = $filecache{$filename} ||= [ read_file($filename) ];
my $lnum = $line;
$line = $file->[$lnum-1];
$line =~ s{^\s+|\s+$}{}g;
if ($_[2]) {
"L$lnum: $_[2]";
} else {
"L$lnum: $line";
}
} else {
""; # invalid $Test::Builder::Level
}
};
goto &$ORIGINAL_ok;
};
1;
__END__
=encoding utf8
=head1 NAME
Test::Name::FromLine - Auto fill test names from caller line
=head1 SYNOPSIS
use Test::Name::FromLine; # just use this
use Test::More;
is 1, 1; #=> ok 1 - L3: is 1, 1;
done_testing;
=head1 DESCRIPTION
Test::Name::FromLine is test utility that fills test names from its file.
Just use this module in test and this module fill test names to all test except named one.
=head1 AUTHOR
cho45 E<lt>cho45@lowreal.netE<gt>
=head1 SEE ALSO
This is inspired from L<http://subtech.g.hatena.ne.jp/motemen/20101214/1292316676>.
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
|