summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/use_ok.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 16:19:41 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 16:19:41 +0100
commite0ee75a6976f08f9bc3868227f1cd11ab6507895 (patch)
tree5366acf520d51f2f3961274ced349a4178685be5 /cpan/Test-Simple/t/use_ok.t
parent8c5b8ff02c62badaeb38078556879720bdf8945a (diff)
downloadperl-e0ee75a6976f08f9bc3868227f1cd11ab6507895.tar.gz
Move Test::Simple from ext/ to cpan/
Diffstat (limited to 'cpan/Test-Simple/t/use_ok.t')
-rw-r--r--cpan/Test-Simple/t/use_ok.t67
1 files changed, 67 insertions, 0 deletions
diff --git a/cpan/Test-Simple/t/use_ok.t b/cpan/Test-Simple/t/use_ok.t
new file mode 100644
index 0000000000..4a62f3557e
--- /dev/null
+++ b/cpan/Test-Simple/t/use_ok.t
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = qw(../lib ../lib/Test/Simple/t/lib);
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use Test::More tests => 15;
+
+# Using Symbol because it's core and exports lots of stuff.
+{
+ package Foo::one;
+ ::use_ok("Symbol");
+ ::ok( defined &gensym, 'use_ok() no args exports defaults' );
+}
+
+{
+ package Foo::two;
+ ::use_ok("Symbol", qw(qualify));
+ ::ok( !defined &gensym, ' one arg, defaults overriden' );
+ ::ok( defined &qualify, ' right function exported' );
+}
+
+{
+ package Foo::three;
+ ::use_ok("Symbol", qw(gensym ungensym));
+ ::ok( defined &gensym && defined &ungensym, ' multiple args' );
+}
+
+{
+ package Foo::four;
+ my $warn; local $SIG{__WARN__} = sub { $warn .= shift; };
+ ::use_ok("constant", qw(foo bar));
+ ::ok( defined &foo, 'constant' );
+ ::is( $warn, undef, 'no warning');
+}
+
+{
+ package Foo::five;
+ ::use_ok("Symbol", 1.02);
+}
+
+{
+ package Foo::six;
+ ::use_ok("NoExporter", 1.02);
+}
+
+{
+ package Foo::seven;
+ local $SIG{__WARN__} = sub {
+ # Old perls will warn on X.YY_ZZ style versions. Not our problem
+ warn @_ unless $_[0] =~ /^Argument "\d+\.\d+_\d+" isn't numeric/;
+ };
+ ::use_ok("Test::More", 0.47);
+}
+
+{
+ package Foo::eight;
+ local $SIG{__DIE__};
+ ::use_ok("SigDie");
+ ::ok(defined $SIG{__DIE__}, ' SIG{__DIE__} preserved');
+}