1 | #!./perl
|
---|
2 |
|
---|
3 | BEGIN {
|
---|
4 | chdir 't' if -d 't';
|
---|
5 | @INC = '../lib';
|
---|
6 | }
|
---|
7 |
|
---|
8 | print "1..28\n";
|
---|
9 |
|
---|
10 | my $i = 1;
|
---|
11 | eval "use 5.000"; # implicit semicolon
|
---|
12 | if ($@) {
|
---|
13 | print STDERR $@,"\n";
|
---|
14 | print "not ";
|
---|
15 | }
|
---|
16 | print "ok ",$i++,"\n";
|
---|
17 |
|
---|
18 | eval "use 5.000;";
|
---|
19 | if ($@) {
|
---|
20 | print STDERR $@,"\n";
|
---|
21 | print "not ";
|
---|
22 | }
|
---|
23 | print "ok ",$i++,"\n";
|
---|
24 |
|
---|
25 | eval sprintf "use %.6f;", $];
|
---|
26 | if ($@) {
|
---|
27 | print STDERR $@,"\n";
|
---|
28 | print "not ";
|
---|
29 | }
|
---|
30 | print "ok ",$i++,"\n";
|
---|
31 |
|
---|
32 |
|
---|
33 | eval sprintf "use %.6f;", $] - 0.000001;
|
---|
34 | if ($@) {
|
---|
35 | print STDERR $@,"\n";
|
---|
36 | print "not ";
|
---|
37 | }
|
---|
38 | print "ok ",$i++,"\n";
|
---|
39 |
|
---|
40 | eval sprintf("use %.6f;", $] + 1);
|
---|
41 | unless ($@) {
|
---|
42 | print "not ";
|
---|
43 | }
|
---|
44 | print "ok ",$i++,"\n";
|
---|
45 |
|
---|
46 | eval sprintf "use %.6f;", $] + 0.00001;
|
---|
47 | unless ($@) {
|
---|
48 | print "not ";
|
---|
49 | }
|
---|
50 | print "ok ",$i++,"\n";
|
---|
51 |
|
---|
52 |
|
---|
53 | { use lib } # check that subparse saves pending tokens
|
---|
54 |
|
---|
55 | local $lib::VERSION = 1.0;
|
---|
56 |
|
---|
57 | eval "use lib 0.9";
|
---|
58 | if ($@) {
|
---|
59 | print STDERR $@,"\n";
|
---|
60 | print "not ";
|
---|
61 | }
|
---|
62 | print "ok ",$i++,"\n";
|
---|
63 |
|
---|
64 | eval "use lib 1.0";
|
---|
65 | if ($@) {
|
---|
66 | print STDERR $@,"\n";
|
---|
67 | print "not ";
|
---|
68 | }
|
---|
69 | print "ok ",$i++,"\n";
|
---|
70 |
|
---|
71 | eval "use lib 1.01";
|
---|
72 | unless ($@) {
|
---|
73 | print "not ";
|
---|
74 | }
|
---|
75 | print "ok ",$i++,"\n";
|
---|
76 |
|
---|
77 |
|
---|
78 | eval "use lib 0.9 qw(fred)";
|
---|
79 | if ($@) {
|
---|
80 | print STDERR $@,"\n";
|
---|
81 | print "not ";
|
---|
82 | }
|
---|
83 | print "ok ",$i++,"\n";
|
---|
84 |
|
---|
85 | print "not " unless ($INC[0] eq "fred" || ($^O eq 'MacOS' && $INC[0] eq ":fred:"));
|
---|
86 | print "ok ",$i++,"\n";
|
---|
87 |
|
---|
88 | eval "use lib 1.0 qw(joe)";
|
---|
89 | if ($@) {
|
---|
90 | print STDERR $@,"\n";
|
---|
91 | print "not ";
|
---|
92 | }
|
---|
93 | print "ok ",$i++,"\n";
|
---|
94 |
|
---|
95 | print "not " unless ($INC[0] eq "joe" || ($^O eq 'MacOS' && $INC[0] eq ":joe:"));
|
---|
96 | print "ok ",$i++,"\n";
|
---|
97 |
|
---|
98 | eval "use lib 1.01 qw(freda)";
|
---|
99 | unless ($@) {
|
---|
100 | print "not ";
|
---|
101 | }
|
---|
102 | print "ok ",$i++,"\n";
|
---|
103 |
|
---|
104 | print "not " if ($INC[0] eq "freda" || ($^O eq 'MacOS' && $INC[0] eq ":freda:"));
|
---|
105 | print "ok ",$i++,"\n";
|
---|
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";
|
---|
114 | unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
|
---|
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";
|
---|
124 | unless ($@ =~ /lib version 100\.105 required--this is only version 35\.3/) {
|
---|
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";
|
---|
156 | unless ($@ =~ /lib v100\.105 required--this is only v35\.36/) {
|
---|
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 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | {
|
---|
174 | # Regression test for patch 14937:
|
---|
175 | # Check that a .pm file with no package or VERSION doesn't core.
|
---|
176 | open F, ">xxx.pm" or die "Cannot open xxx.pm: $!\n";
|
---|
177 | print F "1;\n";
|
---|
178 | close F;
|
---|
179 | eval "use lib '.'; use xxx 3;";
|
---|
180 | unless ($@ =~ /^xxx defines neither package nor VERSION--version check failed at/) {
|
---|
181 | print "not ";
|
---|
182 | }
|
---|
183 | print "ok ",$i++,"\n";
|
---|
184 | unlink 'xxx.pm';
|
---|
185 | }
|
---|