File: method.t

package info (click to toggle)
libtrycatch-perl 1.003000-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 464 kB
  • sloc: perl: 2,590; ansic: 19; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 351 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl

use Test::More tests => 3;

use strict;
use warnings;

use TryCatch;

sub content {
  try {
    return "pass";
  } catch ($e) {
    return "'an error occurred'";
  }
  return "fail";
}

is (main::content(), "pass",        "function");
is (main->content(), "pass",        "class method");
is ((bless {})->content(), "pass", "instance method");