File: dollarat.t

package info (click to toggle)
libdevel-backtrace-perl 0.12-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 180 kB
  • sloc: perl: 541; makefile: 7
file content (20 lines) | stat: -r--r--r-- 562 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!perl
use strict;
use warnings;
use Test::More tests => 4;
use Devel::DollarAt;

eval 'print 0/0; "foo"';

# Don't worry about the "foo"; it serves to make perl 5.8 and 5.10 output the
# same line number so I can use this example in the tests.

my $dollarat = $@;

like("$dollarat", qr{^Illegal division by zero at \(eval \d+\) line 1\.$}, 'stringification');

is ($dollarat->line, 1, 'line');

is ($dollarat->backtrace->point(0)->subroutine, '(eval)', 'subroutine is eval');

is ($dollarat->backtrace->point(0)->called_package, '(unknown)', 'called_package');