dbbda5c038a95004cbf57b26fff406d669ca46a3
[p5sagit/p5-mst-13.2.git] / t / comp / use.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     unshift @INC, '../lib';
6 }
7
8 print "1..15\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 %.5f;", $];
26 if ($@) {
27     print STDERR $@,"\n";
28     print "not ";
29 }
30 print "ok ",$i++,"\n";
31
32
33 eval sprintf "use %.5f;", $] - 0.000001;
34 if ($@) {
35     print STDERR $@,"\n";
36     print "not ";
37 }
38 print "ok ",$i++,"\n";
39
40 eval sprintf("use %.5f;", $] + 1);
41 unless ($@) {
42     print "not ";
43 }
44 print "ok ",$i++,"\n";
45
46 eval sprintf "use %.5f;", $] + 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";
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";
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";
105 print "ok ",$i++,"\n";