xref: /openbsd-src/gnu/usr.bin/perl/cpan/autodie/t/core-trampoline-slurp.t (revision 6fb12b7054efc6b436584db6cef9c2f85c0d7e27)
1#!/usr/bin/perl
2use strict;
3use warnings;
4use Test::More tests => 3;
5
6# Tests for GH #22
7#
8# Slurpy calls (like open, unlink, chown, etc) could not be
9# interpreted properly if they leak into another file which
10# doesn't have autodie enabled.
11
12use autodie;
13use FindBin qw($Bin);
14use lib $Bin;
15use autodie_test_module;
16
17# This will throw an error, but it shouldn't throw a leak-guard
18# failure.
19eval { slurp_leak_open(); };
20unlike($@,qr/Leak-guard failure/, "Leak guard failure (open)");
21
22eval { slurp_leak_unlink(); };
23is($@,"","No error should be thrown by leaked guards (unlink)");
24unlike($@,qr/Leak-guard failure/, "Leak guard failure (unlink)");
25