File: fail2.t

package info (click to toggle)
libtest-class-perl 0.35-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 476 kB
  • ctags: 102
  • sloc: perl: 1,668; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -T

use strict;
use warnings;
use Test::More tests => 2;
use Test::Builder::Tester;

package Object;
sub new {return(undef)};


package Object::Test;
use base qw(Test::Class);
use Test::More;

sub _test_new : Test(3) {
	my $self = shift;
	isa_ok(Object->new, "Object") 
		|| $self->FAIL_ALL('cannot create Objects');
};


package main;
$ENV{TEST_VERBOSE}=0;

my $identifier = ($Test::More::VERSION < 0.88) ? 'object' : 'thing';

test_out("not ok 1 - The $identifier isa Object");
test_out("not ok 2 - cannot create Objects");
test_fail(-12);
test_err( "#   (in Object::Test->_test_new)" );
test_err(qr/#\s+The $identifier isn't defined\n/);
test_fail(-15);
test_err( "#   (in Object::Test->_test_new)" );

Object::Test->runtests;
END {
	test_test("fail2");
	is($?, 2, "exit value okay");
	$? = 0;
}