File: 13-regressions.t

package info (click to toggle)
libtest-trap-perl 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 256 kB
  • sloc: perl: 2,258; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl -T
# -*- mode: cperl ; compile-command: "cd .. ; ./Build ; prove -vb t/13-*.t" -*-

BEGIN { $_ = defined && /(.*)/ && $1 for @ENV{qw/ TMPDIR TEMP TMP /} } # taint vs tempfile
use Test::More tests => 5;
use strict;
use warnings;

BEGIN {
  use_ok( 'Test::Trap' );
}

() = trap { @_ };
is( $trap->leaveby, 'return', 'We may access @_' );
is_deeply( $trap->return, [], 'Empty @_ in the trap block, please' );

() = trap { $_[1] = 1; @_ };
is( $trap->leaveby, 'return', 'We may modify @_' );
is_deeply( $trap->return, [ undef, 1 ], 'Modified @_ in the trap block' );