File: method.t

package info (click to toggle)
libtrycatch-perl 1.003002-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 488 kB
  • ctags: 939
  • sloc: perl: 2,753; makefile: 23; ansic: 19
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");