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