File: end.t

package info (click to toggle)
libtest-nowarnings-perl 0.084-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 112 kB
  • ctags: 21
  • sloc: perl: 169; makefile: 16
file content (40 lines) | stat: -rw-r--r-- 761 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
use strict;

use Test::Tester;

use Test::More tests => 6;

my $cap = Test::Tester::capture();
Test::NoWarnings::builder($cap);

END {
	my @tests = $cap->details;
	cmp_results(
		\@tests,
		[
			{
				actual_ok => 1,
				depth => undef,
			},
			{
				actual_ok => 0,
				depth => undef,
			}
		]
	);

	my $result = $tests[1];
	like($result->{diag}, '/^There were 1 warning\\(s\\)/', "warn diag");
	like($result->{diag}, "/Previous test 1 'fake test'/", "warn diag test num");
	like($result->{diag}, '/my special warning /s', "warn diag has warn");
}

use Test::NoWarnings;

{
	# TB things never expect to be called directly by the test script
	local($Test::Builder::Level) = $Test::Builder::Level - 1;

	$cap->ok(1, "fake test");
	warn "my special warning";
}