File: exception.t

package info (click to toggle)
libdevel-pragma-perl 0.54-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 448 kB
  • sloc: perl: 747; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl

use strict;
use warnings;

use vars qw($ERR);

use Test::More tests => 3;

{
    use Devel::Pragma qw(my_hints);

    BEGIN { my_hints->{'Devel::Pragma::Test::Exception'} = 1 }
    BEGIN { is(my_hints->{'Devel::Pragma::Test::Exception'}, 1, '%^H value set before require') }
    BEGIN { eval 'use DevelPragmaNoSuchFile'; $ERR = $@ }; # BEGIN blocks don't appear to propagate $@

    like($ERR, qr{^Can't locate DevelPragmaNoSuchFile.pm}, 'require raised an exception');

    BEGIN { is(my_hints->{'Devel::Pragma::Test::Exception'}, 1, '%^H value still set after require exception') }
}