diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2002-04-22 09:53:36 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2002-04-22 09:53:36 +0000 |
commit | 98e3f270ffa30af1413b4c0412a1027dbc9b03ed (patch) | |
tree | 0970d30a5ccea65a480ecfbb0095d493a8a6ab31 /lib | |
parent | c00aeceeaac1a4c0eb8269c77dd4b17f85f8deac (diff) | |
download | perl-98e3f270ffa30af1413b4c0412a1027dbc9b03ed.tar.gz |
a Test::Harness tweak to make the test lines show up prettier
p4raw-id: //depot/perl@16068
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Test/Harness.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 0dd0f28a7d..23e7ed89a4 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -36,6 +36,9 @@ my $Ignore_Exitcode = $ENV{HARNESS_IGNORE_EXITCODE}; my $Files_In_Dir = $ENV{HARNESS_FILELEAK_IN_DIR}; +my $Running_In_Perl_Tree = 0; +++$Running_In_Perl_Tree if -d "../t" and -f "../sv.c"; + my $Strap = Test::Harness::Straps->new; @ISA = ('Exporter'); @@ -599,7 +602,11 @@ sub _mk_leader { chomp($te); $te =~ s/\.\w+$/./; - if ($^O eq 'VMS') { $te =~ s/^.*\.t\./\[.t./s; } + if ($^O eq 'VMS') { + $te =~ s/^.*\.t\./\[.t./s; + } + $te =~ s,\\,/,g if $^O eq 'MSWin32'; + $te =~ s,^\.\./,/, if $Running_In_Perl_Tree; my $blank = (' ' x 77); my $leader = "$te" . '.' x ($width - length($te)); my $ml = ""; @@ -625,12 +632,15 @@ sub _leader_width { foreach (@_) { my $suf = /\.(\w+)$/ ? $1 : ''; my $len = length; + $len -= 2 if $Running_In_Perl_Tree and m{^\.\.[/\\]}; my $suflen = length $suf; $maxlen = $len if $len > $maxlen; $maxsuflen = $suflen if $suflen > $maxsuflen; } - # + 3 : we want three dots between the test name and the "ok" - return $maxlen + 3 - $maxsuflen; + # we want three dots between the test name and the "ok" for + # typical lengths, and just two dots if longer than 30 characters + $maxlen -= $maxsuflen; + return $maxlen + ($maxlen >= 30 ? 2 : 3); } |