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