File: runtests_result.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 (46 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (4)
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
#! /usr/bin/perl -T

use strict;
use warnings;

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

sub test1 : Test(1) {
	fail("fails");
}; 

sub test2 : Test(1) {
	pass("passes");
}; 


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

sub test1 : Test(1) {
	pass("a successful test");
}; 


package main;
use Test::Builder::Tester tests => 4;
use Test::More;
$ENV{TEST_VERBOSE}=0;

my $all_ok;

my $filename = sub { return (caller)[1] }->();

test_out( "not ok 1 - fails" );
test_err( "#     Failed test ($filename at line 11)" );
test_err( "#   (in Fail->test1)" );
test_out("ok 2 - passes");
$all_ok = Fail->runtests;
test_test("single failure ran okay");
is($all_ok, 0, "failure detected");

$all_ok = Pass->runtests;
ok($all_ok, "success detected");