Commit | Line | Data |
---|---|---|
729c079f NC |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = ('.', '../lib'); | |
6 | } | |
7 | ||
8 | require 'test.pl'; | |
9 | ||
e4d771f5 | 10 | plan (11); |
729c079f NC |
11 | |
12 | my $blank = ""; | |
13 | eval {select undef, $blank, $blank, 0}; | |
8075d46e | 14 | is ($@, "", 'select undef $blank $blank 0'); |
729c079f | 15 | eval {select $blank, undef, $blank, 0}; |
8075d46e | 16 | is ($@, "", 'select $blank undef $blank 0'); |
729c079f | 17 | eval {select $blank, $blank, undef, 0}; |
8075d46e | 18 | is ($@, "", 'select $blank $blank undef 0'); |
729c079f NC |
19 | |
20 | eval {select "", $blank, $blank, 0}; | |
8075d46e | 21 | is ($@, "", 'select "" $blank $blank 0'); |
729c079f | 22 | eval {select $blank, "", $blank, 0}; |
8075d46e | 23 | is ($@, "", 'select $blank "" $blank 0'); |
729c079f | 24 | eval {select $blank, $blank, "", 0}; |
8075d46e | 25 | is ($@, "", 'select $blank $blank "" 0'); |
15547071 GA |
26 | |
27 | eval {select "a", $blank, $blank, 0}; | |
8075d46e DM |
28 | like ($@, qr/^Modification of a read-only value attempted/, |
29 | 'select "a" $blank $blank 0'); | |
15547071 | 30 | eval {select $blank, "a", $blank, 0}; |
8075d46e DM |
31 | like ($@, qr/^Modification of a read-only value attempted/, |
32 | 'select $blank "a" $blank 0'); | |
15547071 | 33 | eval {select $blank, $blank, "a", 0}; |
8075d46e DM |
34 | like ($@, qr/^Modification of a read-only value attempted/, |
35 | 'select $blank $blank "a" 0'); | |
e4d771f5 | 36 | |
2b983d1f | 37 | my($sleep,$fudge) = (3,0); |
0ebb4f02 JD |
38 | # Actual sleep time on Windows may be rounded down to an integral |
39 | # multiple of the system clock tick interval. Clock tick interval | |
40 | # is configurable, but usually about 15.625 milliseconds. | |
2b983d1f JD |
41 | # time() however doesn't return fractional values, so the observed |
42 | # delay may be 1 second short. | |
43 | ($sleep,$fudge) = (4,1) if $^O eq "MSWin32"; | |
0ebb4f02 | 44 | |
e4d771f5 JD |
45 | my $t = time; |
46 | select(undef, undef, undef, $sleep); | |
8075d46e | 47 | ok(time-$t >= $sleep-$fudge, "select(u,u,u,\$sleep): $sleep seconds have passed"); |
e4d771f5 JD |
48 | |
49 | my $empty = ""; | |
50 | vec($empty,0,1) = 0; | |
51 | $t = time; | |
52 | select($empty, undef, undef, $sleep); | |
8075d46e | 53 | ok(time-$t >= $sleep-$fudge, "select(\$e,u,u,\$sleep): $sleep seconds have passed"); |