File: 07_deprecated_warnings.t

package info (click to toggle)
libtest-nobreakpoints-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 156 kB
  • ctags: 8
  • sloc: perl: 189; makefile: 2
file content (52 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download
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
47
48
49
50
51
52
#!/usr/bin/perl
#
# $Id: 07_deprecated_warnings.t 163 2004-12-31 05:07:16Z james $
#

BEGIN {
    use Test::More;
    eval "use Test::Warn";
    plan skip_all => "Test::Warn required for testing deprecation warnings"
        if $@;
    our $tests = 12;
    eval "use Test::NoWarnings";
    $tests++ unless( $@ );
    plan tests => $tests;
    chdir 't' if -d 't';
    use lib '../lib', '../blib/lib';
}

use Test::NoBreakpoints ':all';

# make sure our deprecated tests warn when they are used
warning_like { no_brkpts_ok('foo') }
    [ qw|deprecated| ],
    "no_brkpts_ok gives a deprecated warning";
warning_is { no_brkpts_ok('foo') }
    "no_brkpts_ok is deprecated (use no_breakpoints_ok instead)",
    "no_brkpts_ok deprecated warning matches expectations";
warning_like { all_files_no_brkpts_ok('foo') }
    [ qw|deprecated| ],
    "all_files_no_brkpts_ok gives a deprecated warning";
warning_is { all_files_no_brkpts_ok('foo') }
    "all_files_no_brkpts_ok is deprecated (use all_files_no_breakpoints_ok instead)",
    "all_files_no_brkpts_ok deprecated warning matches expectations";

# unless we disable deprecation warnings
{
    no warnings 'deprecated';

    warnings_are { no_brkpts_ok('foo') }
        [],
        "no_brkpts_ok gives no warnings if deprecated warnings " .
        "are disabled";

    warnings_are { all_files_no_brkpts_ok('foo') }
        [],
        "all_files_no_brkpts_ok gives no warnings if deprecated " .
        "warnings are disabled";
        
}

#
# EOF