File: sig_die.t

package info (click to toggle)
libpath-tiny-perl 0.148-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 636 kB
  • sloc: perl: 1,300; makefile: 2; sh: 1
file content (32 lines) | stat: -rw-r--r-- 533 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
22
23
24
25
26
27
28
29
30
31
32
use 5.008001;
use strict;
use warnings;
use Test::More 0.96;
use File::Temp qw(tmpnam);

use Path::Tiny;

use lib 't/fakelib';

my $file = path( scalar tmpnam() );
ok $file, 'Got a filename via tmpnam()';

{
    my $fh = $file->openw;
    ok $fh, "Opened $file for writing";

    ok print( $fh "Foo\n" ), "Printed to $file";
}

my $called_handler;

{
    local $SIG{__DIE__} = sub { ++$called_handler };
    $file->slurp_utf8;
}

ok !$called_handler, 'outer $SIG{__DIE__} handler should not be called';

unlink $file;

done_testing;