test harness for C<use x.xxxx>
authorGraham Barr <bodg@tiuk.ti.com>
Mon, 30 Dec 1996 07:00:18 +0000 (07:00 +0000)
committerChip Salzenberg <chip@atlantic.net>
Tue, 31 Dec 1996 20:59:00 +0000 (08:59 +1200)
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>

MANIFEST
t/op/use.t

index ea6fe73..8926a24 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -687,6 +687,7 @@ t/op/tie.t          See if tie/untie functions work
 t/op/time.t            See if time functions work
 t/op/undef.t           See if undef works
 t/op/unshift.t         See if unshift works
+t/op/use.t             See if use works
 t/op/vec.t             See if vectors work
 t/op/write.t           See if write works
 taint.c                        Tainting code
index e69de29..96c59ee 100755 (executable)
@@ -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";