82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / is_of_type.t
CommitLineData
c0956255 1#!/usr/bin/perl -w
2
3# Test _is_of_type()
4
d00e3d8a 5BEGIN {
6 chdir 't' if -d 't';
d00e3d8a 7}
8
9use lib './lib';
c0956255 10use strict;
11use ExtUtils::MakeMaker;
12
13use Test::More "no_plan";
14
15my $is_of_type = \&ExtUtils::MakeMaker::_is_of_type;
16
17my @tests = (
18 [23, "", 1],
19 [[], "", 0],
20 [{}, "", 0],
21 [[], "HASH", 0],
22 [{}, "HASH", 1],
23 [bless({}, "Foo"), "Foo", 1],
24 [bless({}, "Bar"), "Foo", 0],
25 [bless([], "Foo"), "", 0],
26 [bless([], "Foo"), "HASH", 0],
27 [bless([], "Foo"), "ARRAY", 1],
28);
29
30for my $test (@tests) {
31 my($thing, $type, $want) = @$test;
32
33 # [rt.cpan.org 41060]
34 local $SIG{__DIE__} = sub { fail("sigdie should be ignored") };
35 is !!$is_of_type->($thing, $type), !!$want, qq[_is_of_type($thing, '$type'): $want];
36}