Commit | Line | Data |
8ebc5c01 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
20822f61 |
5 | @INC = '../lib'; |
8ebc5c01 |
6 | } |
7 | |
468aa647 |
8 | print "1..31\n"; |
8ebc5c01 |
9 | |
10 | my $i = 1; |
9f3d182e |
11 | eval "use 5.000"; # implicit semicolon |
12 | if ($@) { |
13 | print STDERR $@,"\n"; |
14 | print "not "; |
15 | } |
16 | print "ok ",$i++,"\n"; |
8ebc5c01 |
17 | |
18 | eval "use 5.000;"; |
19 | if ($@) { |
20 | print STDERR $@,"\n"; |
21 | print "not "; |
22 | } |
23 | print "ok ",$i++,"\n"; |
24 | |
468aa647 |
25 | eval "use 6.000;"; |
26 | unless ($@ =~ /Perl v6\.0\.0 required--this is only \Q$^V\E, stopped/) { |
27 | print "not "; |
28 | } |
29 | print "ok ",$i++,"\n"; |
30 | |
31 | eval "no 6.000;"; |
32 | if ($@) { |
33 | print STDERR $@,"\n"; |
34 | print "not "; |
35 | } |
36 | print "ok ",$i++,"\n"; |
37 | |
38 | eval "no 5.000;"; |
39 | unless ($@ =~ /Perls since v5\.0\.0 too modern--this is \Q$^V\E, stopped/) { |
40 | print "not "; |
41 | } |
42 | print "ok ",$i++,"\n"; |
43 | |
6d2c9499 |
44 | eval sprintf "use %.6f;", $]; |
8ebc5c01 |
45 | if ($@) { |
46 | print STDERR $@,"\n"; |
47 | print "not "; |
48 | } |
49 | print "ok ",$i++,"\n"; |
50 | |
51 | |
6d2c9499 |
52 | eval sprintf "use %.6f;", $] - 0.000001; |
8ebc5c01 |
53 | if ($@) { |
54 | print STDERR $@,"\n"; |
55 | print "not "; |
56 | } |
57 | print "ok ",$i++,"\n"; |
58 | |
6d2c9499 |
59 | eval sprintf("use %.6f;", $] + 1); |
8ebc5c01 |
60 | unless ($@) { |
61 | print "not "; |
62 | } |
63 | print "ok ",$i++,"\n"; |
64 | |
6d2c9499 |
65 | eval sprintf "use %.6f;", $] + 0.00001; |
8ebc5c01 |
66 | unless ($@) { |
67 | print "not "; |
68 | } |
69 | print "ok ",$i++,"\n"; |
70 | |
71 | |
18b09519 |
72 | { use lib } # check that subparse saves pending tokens |
8ebc5c01 |
73 | |
74 | local $lib::VERSION = 1.0; |
75 | |
76 | eval "use lib 0.9"; |
77 | if ($@) { |
78 | print STDERR $@,"\n"; |
79 | print "not "; |
80 | } |
81 | print "ok ",$i++,"\n"; |
82 | |
83 | eval "use lib 1.0"; |
84 | if ($@) { |
85 | print STDERR $@,"\n"; |
86 | print "not "; |
87 | } |
88 | print "ok ",$i++,"\n"; |
89 | |
90 | eval "use lib 1.01"; |
91 | unless ($@) { |
92 | print "not "; |
93 | } |
94 | print "ok ",$i++,"\n"; |
95 | |
96 | |
97 | eval "use lib 0.9 qw(fred)"; |
98 | if ($@) { |
99 | print STDERR $@,"\n"; |
100 | print "not "; |
101 | } |
102 | print "ok ",$i++,"\n"; |
103 | |
d5201bd2 |
104 | print "not " unless ($INC[0] eq "fred" || ($^O eq 'MacOS' && $INC[0] eq ":fred:")); |
8ebc5c01 |
105 | print "ok ",$i++,"\n"; |
106 | |
107 | eval "use lib 1.0 qw(joe)"; |
108 | if ($@) { |
109 | print STDERR $@,"\n"; |
110 | print "not "; |
111 | } |
112 | print "ok ",$i++,"\n"; |
113 | |
d5201bd2 |
114 | print "not " unless ($INC[0] eq "joe" || ($^O eq 'MacOS' && $INC[0] eq ":joe:")); |
8ebc5c01 |
115 | print "ok ",$i++,"\n"; |
116 | |
117 | eval "use lib 1.01 qw(freda)"; |
118 | unless ($@) { |
119 | print "not "; |
120 | } |
121 | print "ok ",$i++,"\n"; |
122 | |
d5201bd2 |
123 | print "not " if ($INC[0] eq "freda" || ($^O eq 'MacOS' && $INC[0] eq ":freda:")); |
8ebc5c01 |
124 | print "ok ",$i++,"\n"; |
1571675a |
125 | |
126 | { |
127 | local $lib::VERSION = 35.36; |
128 | eval "use lib v33.55"; |
129 | print "not " if $@; |
130 | print "ok ",$i++,"\n"; |
131 | |
132 | eval "use lib v100.105"; |
9137345a |
133 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.360 \(v35\.360\.0\)/) { |
1571675a |
134 | print "not "; |
135 | } |
136 | print "ok ",$i++,"\n"; |
137 | |
138 | eval "use lib 33.55"; |
139 | print "not " if $@; |
140 | print "ok ",$i++,"\n"; |
141 | |
142 | eval "use lib 100.105"; |
9137345a |
143 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.360 \(v35\.360\.0\)/) { |
1571675a |
144 | print "not "; |
145 | } |
146 | print "ok ",$i++,"\n"; |
147 | |
148 | local $lib::VERSION = '35.36'; |
149 | eval "use lib v33.55"; |
150 | print "not " if $@; |
151 | print "ok ",$i++,"\n"; |
152 | |
153 | eval "use lib v100.105"; |
9137345a |
154 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.360 \(v35\.360\.0\)/) { |
1571675a |
155 | print "not "; |
156 | } |
157 | print "ok ",$i++,"\n"; |
158 | |
159 | eval "use lib 33.55"; |
160 | print "not " if $@; |
161 | print "ok ",$i++,"\n"; |
162 | |
163 | eval "use lib 100.105"; |
9137345a |
164 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.360 \(v35\.360\.0\)/) { |
1571675a |
165 | print "not "; |
166 | } |
167 | print "ok ",$i++,"\n"; |
168 | |
169 | local $lib::VERSION = v35.36; |
170 | eval "use lib v33.55"; |
171 | print "not " if $@; |
172 | print "ok ",$i++,"\n"; |
173 | |
174 | eval "use lib v100.105"; |
e0218a61 |
175 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.036000 \(v35\.36\.0\)/) { |
1571675a |
176 | print "not "; |
177 | } |
178 | print "ok ",$i++,"\n"; |
179 | |
180 | eval "use lib 33.55"; |
181 | print "not " if $@; |
182 | print "ok ",$i++,"\n"; |
183 | |
184 | eval "use lib 100.105"; |
e0218a61 |
185 | unless ($@ =~ /lib version 100.105 \(v100\.105\.0\) required--this is only version 35.036000 \(v35\.36\.0\)/) { |
1571675a |
186 | print "not "; |
187 | } |
188 | print "ok ",$i++,"\n"; |
189 | } |
8312d5ee |
190 | |
191 | |
192 | { |
193 | # Regression test for patch 14937: |
194 | # Check that a .pm file with no package or VERSION doesn't core. |
195 | open F, ">xxx.pm" or die "Cannot open xxx.pm: $!\n"; |
196 | print F "1;\n"; |
197 | close F; |
198 | eval "use lib '.'; use xxx 3;"; |
199 | unless ($@ =~ /^xxx defines neither package nor VERSION--version check failed at/) { |
200 | print "not "; |
201 | } |
202 | print "ok ",$i++,"\n"; |
203 | unlink 'xxx.pm'; |
204 | } |