From 23c7d23d42fc329aaea9e7169d333e3e72a1351f Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sat, 11 Jun 2016 16:15:01 +0000 Subject: [PATCH] + t/base.t --- t/base.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/base.t diff --git a/t/base.t b/t/base.t new file mode 100644 index 0000000..45a42fb --- /dev/null +++ b/t/base.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use Test::More tests => 5; + +require_ok('Subtitle::BASE'); + +{ + package Subtitle::Dummy; + use strict; + use warnings; + use base 'Subtitle::BASE'; + + sub new { + my $class = shift; + my $self = { log => [] }; + return bless ($self, $class); + }; + 1; +} + +my $obj = Subtitle::Dummy->new; +isa_ok($obj, 'Subtitle::Dummy'); + +is(scalar @{ $obj->{log} }, 0); +$obj->log(warn => "something"); +is(scalar @{ $obj->{log} }, 1); +is($obj->{log}->[0], 'W: something'); + +exit 0;