This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Optimize reversing an array in-place
[perl5.git] / t / op / sselect.t
CommitLineData
729c079f
NC
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = ('.', '../lib');
6}
7
8require 'test.pl';
9
e4d771f5 10plan (11);
729c079f
NC
11
12my $blank = "";
13eval {select undef, $blank, $blank, 0};
14is ($@, "");
15eval {select $blank, undef, $blank, 0};
16is ($@, "");
17eval {select $blank, $blank, undef, 0};
18is ($@, "");
19
20eval {select "", $blank, $blank, 0};
15547071 21is ($@, "");
729c079f 22eval {select $blank, "", $blank, 0};
15547071 23is ($@, "");
729c079f 24eval {select $blank, $blank, "", 0};
15547071
GA
25is ($@, "");
26
27eval {select "a", $blank, $blank, 0};
28like ($@, qr/^Modification of a read-only value attempted/);
29eval {select $blank, "a", $blank, 0};
30like ($@, qr/^Modification of a read-only value attempted/);
31eval {select $blank, $blank, "a", 0};
729c079f 32like ($@, qr/^Modification of a read-only value attempted/);
e4d771f5
JD
33
34my $sleep = 3;
35my $t = time;
36select(undef, undef, undef, $sleep);
37ok(time-$t >= $sleep, "$sleep seconds have passed");
38
39my $empty = "";
40vec($empty,0,1) = 0;
41$t = time;
42select($empty, undef, undef, $sleep);
43ok(time-$t >= $sleep, "$sleep seconds have passed");