X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2Ftaint%2Frx.t;fp=t%2Ftaint%2Frx.t;h=0000000000000000000000000000000000000000;hb=386630c145754930ffc3a3b0988dd0108f4394db;hp=acaf6df51a420624710d77ed0624f4688e15db78;hpb=36958ebe8b4c296f858f6b5df8f629cdb341812d;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/t/taint/rx.t b/t/taint/rx.t deleted file mode 100644 index acaf6df..0000000 --- a/t/taint/rx.t +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env perl -T - -=pod - -Equivalent to F but uses perl regexes to untaint. - -=cut - -use strict; -use Test::More; - -BEGIN { - eval { - require Taint::Util; - Taint::Util->import; - }; - - plan $@ - ? (skip_all => "Taint::Util required for taint tests") - : (tests => 8); -} - -use re::engine::Plugin ( - exec => sub { - my ($re, $str) = @_; - - ok(tainted($str) => 'matched string tainted'); - - my $one = $str; - my $two = $str; $two ~~ /(.*)/; $two = $1; - - ok(tainted($one)); - ok(!tainted($two)); - - $re->num_captures( - FETCH => sub { - my ($re, $p) = @_; - - return $one if $p == 1; - return $two if $p == 2; - }, - ); - - 1; - } -); - -my $str = "string"; -taint($str); -ok(tainted($str)); - -if ($str =~ /pattern/) { - cmp_ok $1, 'eq', $str; - ok(tainted($1) => '$1 is tainted'); - - cmp_ok $2, 'eq', $str; - ok(!tainted($2) => '$2 is untainted'); -}