From: Arthur Axel 'fREW' Schmidt Date: Sun, 28 Mar 2010 05:39:11 +0000 (-0500) Subject: tests for Monotonic's previous_version_set X-Git-Tag: v0.001000_01~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b2aa48a2c2a23f5f55cb4ac56409017d9ff663a;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git tests for Monotonic's previous_version_set --- diff --git a/t/version_handlers/monotonic.t b/t/version_handlers/monotonic.t index 33cdfa8..b12f5aa 100644 --- a/t/version_handlers/monotonic.t +++ b/t/version_handlers/monotonic.t @@ -40,7 +40,7 @@ use aliased ); } -{ +ONETOFIVE: { my $vh = Monotonic->new({ to_version => 5, schema_version => 1, @@ -68,6 +68,34 @@ use aliased ok( !$vh->next_version_set, 'still no more versions after final pair' ); } +FIVETOONE: { + my $vh = Monotonic->new({ + to_version => 1, + schema_version => 1, + database_version => 5, + }); + + ok $vh, 'VersionHandler gets instantiated'; + ok( + eq_array($vh->previous_version_set, [4,5]), + 'first version pair works' + ); + ok( + eq_array($vh->previous_version_set, [3,4]), + 'second version pair works' + ); + ok( + eq_array($vh->previous_version_set, [2,3]), + 'third version pair works' + ); + ok( + eq_array($vh->previous_version_set, [1,2]), + 'fourth version pair works' + ); + ok( !$vh->previous_version_set, 'no more versions before initial pair' ); + ok( !$vh->previous_version_set, 'still no more versions before initial pair' ); +} + dies_ok { my $vh = Monotonic->new({ schema_version => 2,