}
# Okay, that'll do for now. The intricacies of the smartmatch
-# semantics are tested in t/op/smartmatch.t
+# semantics are tested in t/op/smartmatch.t. Taintedness of
+# returned values is checked in t/op/taint.t.
__END__
use strict;
use Config;
-plan tests => 774;
+plan tests => 780;
$| = 1;
is_tainted $dest, "ucfirst(tainted) taints its return value";
}
+{
+ # Taintedness of values returned from given()
+ use feature 'switch';
+
+ my @descriptions = ('when', 'given end', 'default');
+
+ for (qw<x y z>) {
+ my $letter = "$_$TAINT";
+
+ my $desc = "tainted value returned from " . shift(@descriptions);
+
+ my $res = do {
+ given ($_) {
+ when ('x') { $letter }
+ when ('y') { goto leavegiven }
+ default { $letter }
+ leavegiven: $letter
+ }
+ };
+ is $res, $letter, "$desc is correct";
+ is_tainted $res, "$desc stays tainted";
+ }
+}
+
# This may bomb out with the alarm signal so keep it last
SKIP: {
skip "No alarm()" unless $Config{d_alarm};