summaryrefslogtreecommitdiff
path: root/t/lib/u-tainted.t
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/u-tainted.t')
-rw-r--r--t/lib/u-tainted.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/lib/u-tainted.t b/t/lib/u-tainted.t
new file mode 100644
index 0000000000..c38cf1a0d9
--- /dev/null
+++ b/t/lib/u-tainted.t
@@ -0,0 +1,33 @@
+#!./perl -T
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+use lib qw(blib/lib blib/arch);
+use Scalar::Util qw(tainted);
+use Config;
+
+print "1..5\n";
+
+print "not " if tainted(1);
+print "ok 1\n";
+
+my $var = 2;
+
+print "not " if tainted($var);
+print "ok 2\n";
+
+my $key = (keys %ENV)[0];
+
+$var = $ENV{$key};
+
+print "not " unless tainted($var);
+print "ok 3\n";
+
+print "not " unless tainted($ENV{$key});
+print "ok 4\n";
+
+print "not " if @ARGV and not tainted($ARGV[0]);
+print "ok 5\n";