summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGraham Barr <bodg@tiuk.ti.com>1996-12-30 07:00:18 +0000
committerChip Salzenberg <chip@atlantic.net>1997-01-01 08:59:00 +1200
commitd5c001ddae568c5769b6a9eb70138c72d385cacb (patch)
tree6df3a91cd021d80003455914008daa2cafc9377d /t
parente616eb7bf79ebe2462a2e07e1fa321a48a9654f2 (diff)
downloadperl-d5c001ddae568c5769b6a9eb70138c72d385cacb.tar.gz
test harness for C<use x.xxxx>
Here is the test harness for version numbers in use statements. It checks both the C<use x.xxx> and C<use MODULE x.xxxx> Paul suggested in an earlier message, the introduction of a pragma directory. I would suggest that this test should also go in the pragma directory. p5p-msgid: <32C76882.3F3C7999@tiuk.ti.com>
Diffstat (limited to 't')
-rwxr-xr-xt/op/use.t101
1 files changed, 101 insertions, 0 deletions
diff --git a/t/op/use.t b/t/op/use.t
index e69de29bb2..96c59ee32c 100755
--- a/t/op/use.t
+++ b/t/op/use.t
@@ -0,0 +1,101 @@
+#!./perl
+
+print "1..14\n";
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+my $i = 1;
+
+eval "use 5.000;";
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+eval sprintf "use %.5f;", $];
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+
+eval sprintf "use %.5f;", $] - 0.000001;
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+eval sprintf("use %.5f;", $] + 1);
+unless ($@) {
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+eval sprintf "use %.5f;", $] + 0.00001;
+unless ($@) {
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+
+
+use lib; # I know that this module will be there.
+
+
+local $lib::VERSION = 1.0;
+
+eval "use lib 0.9";
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+eval "use lib 1.0";
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+eval "use lib 1.01";
+unless ($@) {
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+
+eval "use lib 0.9 qw(fred)";
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+print "not " unless $INC[0] eq "fred";
+print "ok ",$i++,"\n";
+
+eval "use lib 1.0 qw(joe)";
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+print "not " unless $INC[0] eq "joe";
+print "ok ",$i++,"\n";
+
+eval "use lib 1.01 qw(freda)";
+unless ($@) {
+ print "not ";
+}
+print "ok ",$i++,"\n";
+
+print "not " if $INC[0] eq "freda";
+print "ok ",$i++,"\n";