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