summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/op/wantarray.t
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/t/op/wantarray.t')
-rwxr-xr-xcontrib/perl5/t/op/wantarray.t16
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/perl5/t/op/wantarray.t b/contrib/perl5/t/op/wantarray.t
new file mode 100755
index 0000000..0a47b6d
--- /dev/null
+++ b/contrib/perl5/t/op/wantarray.t
@@ -0,0 +1,16 @@
+#!./perl
+
+print "1..3\n";
+sub context {
+ my ( $cona, $testnum ) = @_;
+ my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
+ unless ( $cona eq $conb ) {
+ print "# Context $conb should be $cona\nnot ";
+ }
+ print "ok $testnum\n";
+}
+
+context('V',1);
+$a = context('S',2);
+@a = context('A',3);
+1;
OpenPOWER on IntegriCloud