File: 03_end.t

package info (click to toggle)
libtest-nowarnings-perl 1.04-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 152 kB
  • ctags: 20
  • sloc: perl: 354; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 783 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
#!/usr/bin/perl

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;

SCOPE: {
	# 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";
}