diff options
Diffstat (limited to 't/lib')
-rw-r--r-- | t/lib/Dev/Null.pm | 17 | ||||
-rw-r--r-- | t/lib/sample-tests/inc_taint | 7 | ||||
-rw-r--r-- | t/lib/sample-tests/taint_warn | 11 |
3 files changed, 35 insertions, 0 deletions
diff --git a/t/lib/Dev/Null.pm b/t/lib/Dev/Null.pm new file mode 100644 index 0000000000..2bd2274061 --- /dev/null +++ b/t/lib/Dev/Null.pm @@ -0,0 +1,17 @@ +# For shutting up Test::Harness. +# Has to work on 5.004 which doesn't have Tie::StdHandle. +package Dev::Null; + +sub WRITE {} +sub PRINT {} +sub PRINTF {} +sub TIEHANDLE { + my $class = shift; + my $fh = do { local *HANDLE; \*HANDLE }; + return bless $fh, $class; +} +sub READ {} +sub READLINE {} +sub GETC {} + +1; diff --git a/t/lib/sample-tests/inc_taint b/t/lib/sample-tests/inc_taint new file mode 100644 index 0000000000..c0dc994989 --- /dev/null +++ b/t/lib/sample-tests/inc_taint @@ -0,0 +1,7 @@ +#!/usr/bin/perl -Tw + +use lib qw(t/lib); +use Test::More tests => 1; + +ok( grep(/we_added_this_lib/, @INC) ); + diff --git a/t/lib/sample-tests/taint_warn b/t/lib/sample-tests/taint_warn new file mode 100644 index 0000000000..5b4c486166 --- /dev/null +++ b/t/lib/sample-tests/taint_warn @@ -0,0 +1,11 @@ +#!/usr/bin/perl -tw + +use lib qw(t/lib); +use Test::More tests => 1; + +my $warnings = ''; +{ + local $SIG{__WARN__} = sub { $warnings .= join '', @_ }; + kill 0, $^X; +} +like( $warnings, '/^Insecure dependency/', '-t honored' ); |