Skip Menu |

This queue is for tickets about the Date-Range CPAN distribution.

Report information
The Basics
Id: 60531
Status: open
Priority: 0/
Queue: Date-Range

People
Owner: Nobody in particular
Requestors: jhannah [...] omnihotels.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: gap() bug leads to an abuts() bug
Looks like I stumbled into a gap() bug which also causes abuts() to be wrong: http://github.com/jhannah/date-range/commit/d95a2d I'm working on a patch now. If you want to grant me PAUSE CO-MAINT I can push a corrected version up when ready. j jhannah@cac-dev:~/src/date-range> perl -Ilib t/01.t 1..57 ok 1 - Can't create a range with no dates ok 2 - Can't create a range with one date ok 3 - Can't create a range with three dates ... ok 53 - Abuts M/J - no ok 54 - Abuts M/F - yes ok 55 - Abuts M/M - no not ok 56 - gap() # Failed test 'gap()' # at t/01.t line 132. not ok 57 - Abuts r1/r2 - no # Failed test 'Abuts r1/r2 - no' # at t/01.t line 134. # Looks like you failed 2 tests of 57.
This patch appears to fix it. All your tests pass, and the 2 I added in the previous patch also pass now. diff --git a/lib/Date/Range.pm b/lib/Date/Range.pm index da4cdff..0debfe4 100644 --- a/lib/Date/Range.pm +++ b/lib/Date/Range.pm @@ -168,7 +168,7 @@ sub gap { my @sorted = sort { $a->start <=> $b->start } ($self, $range); my $start = $sorted[0]->end + $self->_day_length; my $end = $sorted[1]->start - $self->_day_length; - return if $start >= $end; + return if $start > $end; return $self->new($start, $end); }
Subject: Re: [rt.cpan.org #60531] gap() bug leads to an abuts() bug
Date: Thu, 19 Aug 2010 23:55:13 +0300
To: bug-Date-Range [...] rt.cpan.org
From: Tony Bowden <tony [...] tmtm.com>
On Thu, Aug 19, 2010 at 11:41 PM, Jay Hannah via RT <bug-Date-Range@rt.cpan.org> wrote: Show quoted text
> I'm working on a patch now. If you want to grant me PAUSE CO-MAINT I can > push a corrected version up when ready.
Done. Thanks for the fix. Tony
On Thu Aug 19 16:55:46 2010, tony@tmtm.com wrote: Show quoted text
> Done. Thanks for the fix.
Wow! That was fast! Thanks! :) j