~ubuntu-branches/ubuntu/precise/liberror-perl/precise

« back to all changes in this revision

Viewing changes to t/11rethrow.t

  • Committer: Bazaar Package Importer
  • Author(s): Clint Burfoot
  • Date: 2007-12-02 16:20:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071202162039-gyz66vprze51ob4z
Tags: 0.17-1
* New upstream version (closes: #383606)
* debian/rules: use CURDIR instead of PWD (closes: #390482)
* debian/copyright: update copy of author's copyright
* debian/control: new standards version, debhelper dependency
* lib/Error/Simple.pm: manpage fix to POD

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use Error qw(:try);
 
4
use Test::More tests => 4;
 
5
 
 
6
try {
 
7
        try { die "inner" }
 
8
        catch Error::Simple with { die "foobar" };
 
9
}
 
10
otherwise
 
11
{
 
12
        my $err = shift;
 
13
    # TEST
 
14
    ok (scalar($err =~ /foobar/), "Error rethrown");
 
15
};
 
16
 
 
17
try {
 
18
        try { die "inner" }
 
19
        catch Error::Simple with { throw Error::Simple "foobar" };
 
20
}
 
21
otherwise
 
22
{
 
23
        my $err = shift;
 
24
    # TEST
 
25
        ok (scalar("$err" =~ /foobar/), "Thrown Error::Simple");
 
26
};
 
27
 
 
28
try {
 
29
        try { die "inner" }
 
30
        otherwise { die "foobar" };
 
31
}
 
32
otherwise
 
33
{
 
34
    my $err = shift;
 
35
    # TEST
 
36
        ok (scalar("$err" =~ /foobar/), "die foobar");
 
37
};
 
38
 
 
39
try {
 
40
        try { die "inner" }
 
41
        catch Error::Simple with { throw Error::Simple "foobar" };
 
42
}
 
43
otherwise
 
44
{
 
45
        my $err = shift;
 
46
    # TEST
 
47
        ok (scalar($err =~ /foobar/), "throw Error::Simple");
 
48
};
 
49
 
 
50
1;