summaryrefslogtreecommitdiff
path: root/lib/blib.t
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2001-09-08 15:45:46 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-09 00:32:05 +0000
commita635c9437ef25a8c106276588579a3871545a5ac (patch)
treefdea192f20a5ad1bcb5b3b81740999b8ced21d9c /lib/blib.t
parentb38b066d1cf1b115dd83bdf7e4355e8870134fb9 (diff)
downloadperl-a635c9437ef25a8c106276588579a3871545a5ac.tar.gz
[REPATCH] Re: [PATCH] new test lib/blib.t
Message-ID: <20010908194546.C9193@blackrider> p4raw-id: //depot/perl@11953
Diffstat (limited to 'lib/blib.t')
-rw-r--r--lib/blib.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/blib.t b/lib/blib.t
new file mode 100644
index 0000000000..4e0d3ea713
--- /dev/null
+++ b/lib/blib.t
@@ -0,0 +1,45 @@
+#!./perl -Tw
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+use strict;
+
+sub _cleanup {
+ rmdir foreach reverse qw(blib blib/arch blib/lib);
+ unlink "stderr";
+}
+
+sub _mkdirs {
+ for my $dir (@_) {
+ next if -d $dir;
+ mkdir $dir or die "Can't mkdir $dir: $!" if ! -d $dir;
+ }
+}
+
+
+BEGIN { _cleanup }
+
+use Test::More tests => 7;
+
+eval 'use blib;';
+ok( $@ =~ /Cannot find blib/, 'Fails if blib directory not found' );
+
+_mkdirs(qw(blib blib/arch blib/lib));
+
+{
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings = join '', @_ };
+ use_ok('blib');
+ is( $warnings, '', 'use blib is niiiice and quiet' );
+}
+
+is( @INC, 3, '@INC now has 3 elements' );
+is( $INC[2], '../lib', 'blib added to the front of @INC' );
+
+ok( grep(m|blib/lib$|, @INC[0,1]) == 1, ' blib/lib in @INC');
+ok( grep(m|blib/arch$|, @INC[0,1]) == 1, ' blib/arch in @INC');
+
+END { _cleanup(); }