This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The #14949 removed this error from non-Win32.
[perl5.git] / t / comp / use.t
CommitLineData
8ebc5c01
PP
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
8ebc5c01
PP
6}
7
1571675a 8print "1..27\n";
8ebc5c01
PP
9
10my $i = 1;
9f3d182e
GS
11eval "use 5.000"; # implicit semicolon
12if ($@) {
13 print STDERR $@,"\n";
14 print "not ";
15}
16print "ok ",$i++,"\n";
8ebc5c01
PP
17
18eval "use 5.000;";
19if ($@) {
20 print STDERR $@,"\n";
21 print "not ";
22}
23print "ok ",$i++,"\n";
24
25eval sprintf "use %.5f;", $];
26if ($@) {
27 print STDERR $@,"\n";
28 print "not ";
29}
30print "ok ",$i++,"\n";
31
32
33eval sprintf "use %.5f;", $] - 0.000001;
34if ($@) {
35 print STDERR $@,"\n";
36 print "not ";
37}
38print "ok ",$i++,"\n";
39
40eval sprintf("use %.5f;", $] + 1);
41unless ($@) {
42 print "not ";
43}
44print "ok ",$i++,"\n";
45
46eval sprintf "use %.5f;", $] + 0.00001;
47unless ($@) {
48 print "not ";
49}
50print "ok ",$i++,"\n";
51
52
18b09519 53{ use lib } # check that subparse saves pending tokens
8ebc5c01
PP
54
55local $lib::VERSION = 1.0;
56
57eval "use lib 0.9";
58if ($@) {
59 print STDERR $@,"\n";
60 print "not ";
61}
62print "ok ",$i++,"\n";
63
64eval "use lib 1.0";
65if ($@) {
66 print STDERR $@,"\n";
67 print "not ";
68}
69print "ok ",$i++,"\n";
70
71eval "use lib 1.01";
72unless ($@) {
73 print "not ";
74}
75print "ok ",$i++,"\n";
76
77
78eval "use lib 0.9 qw(fred)";
79if ($@) {
80 print STDERR $@,"\n";
81 print "not ";
82}
83print "ok ",$i++,"\n";
84
85print "not " unless $INC[0] eq "fred";
86print "ok ",$i++,"\n";
87
88eval "use lib 1.0 qw(joe)";
89if ($@) {
90 print STDERR $@,"\n";
91 print "not ";
92}
93print "ok ",$i++,"\n";
94
95print "not " unless $INC[0] eq "joe";
96print "ok ",$i++,"\n";
97
98eval "use lib 1.01 qw(freda)";
99unless ($@) {
100 print "not ";
101}
102print "ok ",$i++,"\n";
103
104print "not " if $INC[0] eq "freda";
105print "ok ",$i++,"\n";
1571675a
GS
106
107{
108 local $lib::VERSION = 35.36;
109 eval "use lib v33.55";
110 print "not " if $@;
111 print "ok ",$i++,"\n";
112
113 eval "use lib v100.105";
ae165b0c 114 unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
1571675a
GS
115 print "not ";
116 }
117 print "ok ",$i++,"\n";
118
119 eval "use lib 33.55";
120 print "not " if $@;
121 print "ok ",$i++,"\n";
122
123 eval "use lib 100.105";
ae165b0c 124 unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
1571675a
GS
125 print "not ";
126 }
127 print "ok ",$i++,"\n";
128
129 local $lib::VERSION = '35.36';
130 eval "use lib v33.55";
131 print "not " if $@;
132 print "ok ",$i++,"\n";
133
134 eval "use lib v100.105";
135 unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
136 print "not ";
137 }
138 print "ok ",$i++,"\n";
139
140 eval "use lib 33.55";
141 print "not " if $@;
142 print "ok ",$i++,"\n";
143
144 eval "use lib 100.105";
145 unless ($@ =~ /lib version 100\.105 required--this is only version 35\.36/) {
146 print "not ";
147 }
148 print "ok ",$i++,"\n";
149
150 local $lib::VERSION = v35.36;
151 eval "use lib v33.55";
152 print "not " if $@;
153 print "ok ",$i++,"\n";
154
155 eval "use lib v100.105";
cc507455 156 unless ($@ =~ /lib v100\.105 required--this is only v35\.36/) {
1571675a
GS
157 print "not ";
158 }
159 print "ok ",$i++,"\n";
160
161 eval "use lib 33.55";
162 print "not " if $@;
163 print "ok ",$i++,"\n";
164
165 eval "use lib 100.105";
166 unless ($@ =~ /lib version 100\.105 required--this is only version 35\.036/) {
167 print "not ";
168 }
169 print "ok ",$i++,"\n";
170}