Upgrade to Test-Simple-0.82.
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / use_ok.t
CommitLineData
89c1e84a 1#!/usr/bin/perl -w
ccbd73a4 2# $Id: /mirror/googlecode/test-more/t/use_ok.t 57943 2008-08-18T02:09:22.275428Z brooklyn.kid51 $
89c1e84a 3
33459055 4BEGIN {
a9153838 5 if( $ENV{PERL_CORE} ) {
6 chdir 't';
dfa82ec0 7 @INC = qw(../lib ../lib/Test/Simple/t/lib);
30e302f8 8 }
9 else {
10 unshift @INC, 't/lib';
a9153838 11 }
33459055 12}
13
ccbd73a4 14use Test::More tests => 15;
33459055 15
16# Using Symbol because it's core and exports lots of stuff.
17{
18 package Foo::one;
19 ::use_ok("Symbol");
20 ::ok( defined &gensym, 'use_ok() no args exports defaults' );
21}
22
23{
24 package Foo::two;
25 ::use_ok("Symbol", qw(qualify));
26 ::ok( !defined &gensym, ' one arg, defaults overriden' );
27 ::ok( defined &qualify, ' right function exported' );
28}
29
30{
31 package Foo::three;
32 ::use_ok("Symbol", qw(gensym ungensym));
33 ::ok( defined &gensym && defined &ungensym, ' multiple args' );
34}
89c1e84a 35
36{
37 package Foo::four;
38 my $warn; local $SIG{__WARN__} = sub { $warn .= shift; };
39 ::use_ok("constant", qw(foo bar));
40 ::ok( defined &foo, 'constant' );
41 ::is( $warn, undef, 'no warning');
42}
30e302f8 43
44{
45 package Foo::five;
46 ::use_ok("Symbol", 1.02);
47}
48
49{
50 package Foo::six;
51 ::use_ok("NoExporter", 1.02);
52}
53
54{
55 package Foo::seven;
56 local $SIG{__WARN__} = sub {
57 # Old perls will warn on X.YY_ZZ style versions. Not our problem
58 warn @_ unless $_[0] =~ /^Argument "\d+\.\d+_\d+" isn't numeric/;
59 };
60 ::use_ok("Test::More", 0.47);
61}
ccbd73a4 62
63{
64 package Foo::eight;
65 local $SIG{__DIE__};
66 ::use_ok("SigDie");
67 ::ok(defined $SIG{__DIE__}, ' SIG{__DIE__} preserved');
68}