From afec75b35248ba576b99898a973e5263335f1764 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Fri, 15 Mar 2024 08:35:35 +0300 Subject: [PATCH] #67 allow month --- bibcop.pl | 2 +- perl-tests/checks.pl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bibcop.pl b/bibcop.pl index 8879435..bd60811 100755 --- a/bibcop.pl +++ b/bibcop.pl @@ -428,7 +428,7 @@ sub check_month { my (%entry) = @_; if (exists $entry{'month'}) { my $month = $entry{'month'}; - if (not $month =~ /^[1-9]|10|11|12$/) { + if (not $month =~ /^[1-9]|10|11|12|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec$/) { return "The format of the 'month' is wrong" } } diff --git a/perl-tests/checks.pl b/perl-tests/checks.pl index 652dbb3..1e0cf83 100755 --- a/perl-tests/checks.pl +++ b/perl-tests/checks.pl @@ -115,6 +115,13 @@ package bibcop; check_passes($f, ('year' => '2022')); check_passes($f, ('year' => '1612')); +$f = 'check_month'; +check_fails($f, ('month' => 'January')); +check_fails($f, ('month' => '01')); +check_passes($f, ('month' => 'jan')); +check_passes($f, ('month' => '1')); +check_passes($f, ('month' => '12')); + $f = 'check_pages'; check_fails($f, ('pages' => '1a')); check_fails($f, ('pages' => '40A'));