From: Dagfinn Ilmari Mannsåker Date: Tue, 4 Dec 2012 16:20:01 +0000 (+0000) Subject: Don't rely on hash order in tests (RT#81564) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;p=gitmo%2FMooseX-AttributeHelpers.git Don't rely on hash order in tests (RT#81564) --- diff --git a/ChangeLog b/ChangeLog index bd1d4f9..a054a05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ Revision history for Perl extension MooseX-AttributeHelpers + - Don't rely on hash order in tests (RT#81564) + 0.23 Fri Jan 1, 2010 - A small internals fix to prevent breakage with the next version of Moose. (Dave Rolsky) diff --git a/t/003_basic_hash.t b/t/003_basic_hash.t index 1f842ae..a10b506 100644 --- a/t/003_basic_hash.t +++ b/t/003_basic_hash.t @@ -170,10 +170,10 @@ is_deeply($options->provides, { is($options->type_constraint->type_parameter, 'Str', '... got the right container type'); $stuff->set_option( oink => "blah", xxy => "flop" ); -my @key_value = $stuff->key_value; +my @key_value = sort { $a->[0] cmp $b->[0] } $stuff->key_value; is_deeply( \@key_value, - [ [ 'xxy', 'flop' ], [ 'quantity', 4 ], [ 'oink', 'blah' ] ], + [ [ 'oink', 'blah' ], [ 'quantity', 4 ], [ 'xxy', 'flop' ] ], '... got the right key value pairs' ); diff --git a/t/203_trait_hash.t b/t/203_trait_hash.t index 8e876b1..173e5db 100644 --- a/t/203_trait_hash.t +++ b/t/203_trait_hash.t @@ -156,10 +156,10 @@ is_deeply($options->provides, { is($options->type_constraint->type_parameter, 'Str', '... got the right container type'); $stuff->set_option( oink => "blah", xxy => "flop" ); -my @key_value = $stuff->key_value; +my @key_value = sort { $a->[0] cmp $b->[0] } $stuff->key_value; is_deeply( \@key_value, - [ [ 'xxy', 'flop' ], [ 'quantity', 4 ], [ 'oink', 'blah' ] ], + [ [ 'oink', 'blah' ], [ 'quantity', 4 ], [ 'xxy', 'flop' ] ], '... got the right key value pairs' );