From 9dfb7ed9ced3d50b6877d9a2ae299bad463e0bcd Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Tue, 3 Dec 2024 16:54:30 -0500 Subject: [PATCH] Added t/30-basics.t --- Changes | 3 +++ lib/Genealogy/ObituaryDailyTimes.pm | 3 ++- t/30-basics.t | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 t/30-basics.t diff --git a/Changes b/Changes index 9ed6e80..dbfbbe8 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Genealogy::ObituaryDailyTimes +0.14 + Added t/30-basics.t + 0.13 Sun Sep 15 14:52:02 EDT 2024 search() can now just take one parameter which is the last name Added CircleCI, Coveralls and Codecov diff --git a/lib/Genealogy/ObituaryDailyTimes.pm b/lib/Genealogy/ObituaryDailyTimes.pm index 4c0167a..555f559 100644 --- a/lib/Genealogy/ObituaryDailyTimes.pm +++ b/lib/Genealogy/ObituaryDailyTimes.pm @@ -83,7 +83,8 @@ sub new { =cut -sub search { +sub search +{ my $self = shift; my $params = $self->_get_params('last', @_); diff --git a/t/30-basics.t b/t/30-basics.t new file mode 100644 index 0000000..54909e6 --- /dev/null +++ b/t/30-basics.t @@ -0,0 +1,23 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More tests => 4; + +# Module loads +BEGIN { use_ok('Genealogy::ObituaryDailyTimes') } + +# Object creation +my $directory = 'lib/Genealogy/ObituaryDailyTimes/data'; +my $called = 0; +my $logger = sub { $called++ }; +my $obj = Genealogy::ObituaryDailyTimes->new( + directory => $directory, + logger => $logger +); +ok($obj, 'Object created successfully'); + +# Method 'search' for mandatory 'last' argument +my $result = $obj->search(last => 'Smith'); +ok($result, 'Search method works with mandatory "last" argument'); +cmp_ok($called, '>', 0, 'Logger has been called');