File: 05_no_breakpoints_ok.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 (61 lines) | stat: -rw-r--r-- 1,286 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
53
54
55
56
57
58
59
60
61
#
# $Id: 05_no_breakpoints_ok.t 163 2004-12-31 05:07:16Z james $
#

BEGIN {
    use Test::Tester 0.09;
    use Test::More;
    our $tests = 46;
    eval "use Test::NoWarnings";
    $tests++ unless( $@ );
    plan tests => $tests;
    chdir 't' if -d 't';
    use lib '../lib', '../blib/lib';
}

use Test::NoBreakpoints;

# test the tester for success
check_test(
    sub { no_breakpoints_ok('foo') },
    {
        ok   => 1,
        name => 'no breakpoint test of foo',
    },
    'no_breakpoints_ok works with implicit name',
);
check_test(
    sub { no_breakpoints_ok('foo', 'yes, we have no breakpoints!') },
    {
        ok   => 1,
        name => 'yes, we have no breakpoints!',
    },
    'no_breakpoints_ok works with explicit name',
);

# test the tester for failure
my @expected = (
    '$DB::signal =1',
    q{$DB'single=4},
    '$DB::signal= 1',
    '$DB::single = 3',
    '$DB::single = 1',
    q|$DB::single
=
1|,
);
for my $file( qw|bar1 bar2 bar3 bar4 bar5 bar6| ) {
    check_test(
        sub { no_breakpoints_ok($file) },
        {
            ok   => 0,
            name => "no breakpoint test of $file",
            diag => "breakpoint found in $file: " . shift(@expected) . "\n",
        },
        'no_breakpoints_ok finds simple breakpoint',
    );
}

#
# EOF