Thread Test::Class - Fehlermeldungen unterdrücken?
(10 answers)
Opened by roooot at 2011-03-20 11:12
Man kann auch ohne Klassen die Vererbung nutzen:
Code (perl): (dl
)
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 package Test::MyMore; use strict; use warnings; use Test::More; use base qw(Test::More); our @EXPORT=(@Test::More::EXPORT, qw(cmp_not_ok)); sub cmp_not_ok($$$;$) { my ($got,$op,$exp,$name)=@_; my $tb = Test::More->builder; my $error; my $ok; { local( $@, $!, $SIG{__DIE__} ); $ok=!eval "\$got $op \$exp"; $error=$@; } if($error) { $ok = $tb->ok( $ok, $name ); $tb->diag(" $error\n"); } else { $ok = $tb->ok( $ok, $name ); } return $ok; } 1; |