Thread Test::Class - Fehlermeldungen unterdrücken? (10 answers)
Opened by roooot at 2011-03-20 11:12

topeg
 2011-03-24 19:43
#146885 #146885
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
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;

View full thread Test::Class - Fehlermeldungen unterdrücken?