File: 19_insideout.t

package info (click to toggle)
libparams-util-perl 1.07-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 356 kB
  • sloc: perl: 2,407; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 836 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl

# Test for a custom isa method that returns the same way that
# Object::InsideOut does.

use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
	$ENV{PERL_PARAMS_UTIL_PP} ||= 1;
}

use Test::More tests => 2;
use Scalar::Util ();
use Params::Util ();





#####################################################################
# Create an object and test it

SCOPE: {
	my $object = Foo->new;
	ok( Scalar::Util::blessed($object), 'Foo' );
	my $instance = Params::Util::_INSTANCE($object, 'Foo');
	is( $instance, undef, '_INSTANCE correctly returns undef' );
}





#####################################################################
# Create a package to simulate Object::InsideOut

CLASS: {
	package Foo;

	sub new {
		my $foo  = 1234;
		my $self = \$foo;
		bless $self, $_[0];
		return $self;
	}

	sub isa {
		return ('');
	}

	1;
}