Debian lenny version packages
[pkg-perl] / deb-src / libwww-mechanize-perl / libwww-mechanize-perl-1.34 / t / taint.t
1 #!perl -T
2
3 use warnings;
4 use strict;
5 use Test::More;
6
7 BEGIN {
8     eval 'use Test::Taint';
9     plan skip_all => 'Test::Taint required for checking taintedness' if $@;
10     plan tests=>6;
11 }
12
13 BEGIN { delete @ENV{ qw( http_proxy HTTP_PROXY ) }; }
14 BEGIN {
15     use_ok( 'WWW::Mechanize' );
16 }
17
18 my $mech = WWW::Mechanize->new( autocheck => 1 );
19 isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
20
21 $mech->get( 'file:t/google.html' );
22
23 # Make sure taint checking is on correctly
24 my @keys = keys %ENV;
25 tainted_ok( $ENV{ $keys[0] }, 'ENV taints OK' );
26
27 is( $mech->title, 'Google', 'Correct title' );
28 untainted_ok( $mech->title, 'Title should not be tainted' );
29
30 tainted_ok( $mech->content, 'But content should' );