From: Peter Rabbitson Date: Sat, 21 Feb 2009 16:28:13 +0000 (+0000) Subject: Extend ordered test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=97bfce50cbe5cf9eaa28efb601e2525bd40ca5bb;p=dbsrgits%2FDBIx-Class-Historic.git Extend ordered test --- diff --git a/t/87ordered.t b/t/87ordered.t index 7bc1bed..4844053 100644 --- a/t/87ordered.t +++ b/t/87ordered.t @@ -10,7 +10,7 @@ use POSIX qw(ceil); my $schema = DBICTest->init_schema(); -plan tests => 879; +plan tests => 1269; my $employees = $schema->resultset('Employee'); $employees->delete(); @@ -218,22 +218,34 @@ sub hammer_rs { ok( check_rs($rs), "move_to( $position => $to_position )" ); } - ($row) = $rs->search({ position=>$position })->all(); + $row = $rs->find({ position => $position }); if ($position==1) { ok( !$row->previous_sibling(), 'no previous sibling' ); ok( !$row->first_sibling(), 'no first sibling' ); + ok( $row->next_sibling->position > $position, 'next sibling position > than us'); + is( $row->next_sibling->previous_sibling->position, $position, 'next-prev sibling is us'); + ok( $row->last_sibling->position > $position, 'last sibling position > than us'); } else { ok( $row->previous_sibling(), 'previous sibling' ); ok( $row->first_sibling(), 'first sibling' ); + ok( $row->previous_sibling->position < $position, 'prev sibling position < than us'); + is( $row->previous_sibling->next_sibling->position, $position, 'prev-next sibling is us'); + ok( $row->first_sibling->position < $position, 'first sibling position < than us'); } if ($position==$count) { ok( !$row->next_sibling(), 'no next sibling' ); ok( !$row->last_sibling(), 'no last sibling' ); + ok( $row->previous_sibling->position < $position, 'prev sibling position < than us'); + is( $row->previous_sibling->next_sibling->position, $position, 'prev-next sibling is us'); + ok( $row->first_sibling->position < $position, 'first sibling position < than us'); } else { ok( $row->next_sibling(), 'next sibling' ); ok( $row->last_sibling(), 'last sibling' ); + ok( $row->next_sibling->position > $row->position, 'next sibling position > than us'); + is( $row->next_sibling->previous_sibling->position, $position, 'next-prev sibling is us'); + ok( $row->last_sibling->position > $row->position, 'last sibling position > than us'); } }