fix parse error on C<{ use strict }> and other constructs that
[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..14\n";
9
10 my $i = 1;
11
12 eval "use 5.000;";
13 if ($@) {
14     print STDERR $@,"\n";
15     print "not ";
16 }
17 print "ok ",$i++,"\n";
18
19 eval sprintf "use %.5f;", $];
20 if ($@) {
21     print STDERR $@,"\n";
22     print "not ";
23 }
24 print "ok ",$i++,"\n";
25
26
27 eval sprintf "use %.5f;", $] - 0.000001;
28 if ($@) {
29     print STDERR $@,"\n";
30     print "not ";
31 }
32 print "ok ",$i++,"\n";
33
34 eval sprintf("use %.5f;", $] + 1);
35 unless ($@) {
36     print "not ";
37 }
38 print "ok ",$i++,"\n";
39
40 eval sprintf "use %.5f;", $] + 0.00001;
41 unless ($@) {
42     print "not ";
43 }
44 print "ok ",$i++,"\n";
45
46
47 { use lib }     # check that subparse saves pending tokens
48
49 local $lib::VERSION = 1.0;
50
51 eval "use lib 0.9";
52 if ($@) {
53     print STDERR $@,"\n";
54     print "not ";
55 }
56 print "ok ",$i++,"\n";
57
58 eval "use lib 1.0";
59 if ($@) {
60     print STDERR $@,"\n";
61     print "not ";
62 }
63 print "ok ",$i++,"\n";
64
65 eval "use lib 1.01";
66 unless ($@) {
67     print "not ";
68 }
69 print "ok ",$i++,"\n";
70
71
72 eval "use lib 0.9 qw(fred)";
73 if ($@) {
74     print STDERR $@,"\n";
75     print "not ";
76 }
77 print "ok ",$i++,"\n";
78
79 print "not " unless $INC[0] eq "fred";
80 print "ok ",$i++,"\n";
81
82 eval "use lib 1.0 qw(joe)";
83 if ($@) {
84     print STDERR $@,"\n";
85     print "not ";
86 }
87 print "ok ",$i++,"\n";
88
89 print "not " unless $INC[0] eq "joe";
90 print "ok ",$i++,"\n";
91
92 eval "use lib 1.01 qw(freda)";
93 unless ($@) {
94     print "not ";
95 }
96 print "ok ",$i++,"\n";
97
98 print "not " if $INC[0] eq "freda";
99 print "ok ",$i++,"\n";