1#!/usr/bin/perl -wT
2
3use strict;
4use warnings;
5use lib 't/lib';
6
7use Test::More tests => 7;
8
9use_ok('TAP::Object');
10
11can_ok( 'TAP::Object', 'new' );
12can_ok( 'TAP::Object', '_initialize' );
13can_ok( 'TAP::Object', '_croak' );
14
15{
16
17    package TAP::TestObj;
18    use base qw(TAP::Object);
19
20    sub _initialize {
21        my $self = shift;
22        $self->{init} = 1;
23        $self->{args} = [@_];
24        return $self;
25    }
26}
27
28# I know these tests are simple, but they're documenting the base API, so
29# necessary none-the-less...
30my $obj = TAP::TestObj->new( 'foo', { bar => 'baz' } );
31ok( $obj->{init}, '_initialize' );
32is_deeply( $obj->{args}, [ 'foo', { bar => 'baz' } ], '_initialize: args' );
33
34eval { $obj->_croak('eek') };
35my $err = $@;
36like( $err, qr/^eek/, '_croak' );
37
38