This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix parse error on C<{ use strict }> and other constructs that
[perl5.git] / t / comp / use.t
CommitLineData
8ebc5c01
PP
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
93430cb4 5 unshift @INC, '../lib';
8ebc5c01
PP
6}
7
8print "1..14\n";
9
10my $i = 1;
11
12eval "use 5.000;";
13if ($@) {
14 print STDERR $@,"\n";
15 print "not ";
16}
17print "ok ",$i++,"\n";
18
19eval sprintf "use %.5f;", $];
20if ($@) {
21 print STDERR $@,"\n";
22 print "not ";
23}
24print "ok ",$i++,"\n";
25
26
27eval sprintf "use %.5f;", $] - 0.000001;
28if ($@) {
29 print STDERR $@,"\n";
30 print "not ";
31}
32print "ok ",$i++,"\n";
33
34eval sprintf("use %.5f;", $] + 1);
35unless ($@) {
36 print "not ";
37}
38print "ok ",$i++,"\n";
39
40eval sprintf "use %.5f;", $] + 0.00001;
41unless ($@) {
42 print "not ";
43}
44print "ok ",$i++,"\n";
45
46
18b09519 47{ use lib } # check that subparse saves pending tokens
8ebc5c01
PP
48
49local $lib::VERSION = 1.0;
50
51eval "use lib 0.9";
52if ($@) {
53 print STDERR $@,"\n";
54 print "not ";
55}
56print "ok ",$i++,"\n";
57
58eval "use lib 1.0";
59if ($@) {
60 print STDERR $@,"\n";
61 print "not ";
62}
63print "ok ",$i++,"\n";
64
65eval "use lib 1.01";
66unless ($@) {
67 print "not ";
68}
69print "ok ",$i++,"\n";
70
71
72eval "use lib 0.9 qw(fred)";
73if ($@) {
74 print STDERR $@,"\n";
75 print "not ";
76}
77print "ok ",$i++,"\n";
78
79print "not " unless $INC[0] eq "fred";
80print "ok ",$i++,"\n";
81
82eval "use lib 1.0 qw(joe)";
83if ($@) {
84 print STDERR $@,"\n";
85 print "not ";
86}
87print "ok ",$i++,"\n";
88
89print "not " unless $INC[0] eq "joe";
90print "ok ",$i++,"\n";
91
92eval "use lib 1.01 qw(freda)";
93unless ($@) {
94 print "not ";
95}
96print "ok ",$i++,"\n";
97
98print "not " if $INC[0] eq "freda";
99print "ok ",$i++,"\n";