From ceb2f8ea10f1703bbed89463a3a6a3e03afcfa7c Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Sun, 5 May 2013 11:17:21 +0200 Subject: [PATCH] [t] do not compare hashes by string --- t/99-common.pl6 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/99-common.pl6 b/t/99-common.pl6 index b660eaf5..94ca4d37 100644 --- a/t/99-common.pl6 +++ b/t/99-common.pl6 @@ -19,6 +19,10 @@ sub magic_cmp(@a, @b) { $res; } +sub hash-str(%h) { + %h.sort.map({ join '', .key, '=«', .value, '»' }).join('; '); +} + # Verify that the driver loads before attempting a connect my $drh = DBIish.install_driver($*mdriver); ok $drh, 'Install driver'; # test 1 @@ -136,8 +140,8 @@ ok $sth.execute(), 'execute prepared statement for fetchrow_hashref'; #test 20 if $sth.can('column_names') { ok my $hashref = $sth.fetchrow_hashref(), 'called fetchrow_hashref'; #test 21 - is $hashref, { 'name' => 'TAFM', 'description' => 'Mild fish taco', 'quantity' - => 1, 'price' => '4.85' }, 'selected data matches test hashref'; #test 22 + is hash-str($hashref), hash-str({ 'name' => 'TAFM', 'description' => 'Mild fish taco', 'quantity' + => 1, 'price' => '4.85' }), 'selected data matches test hashref'; #test 22 $sth.finish; } else { skip 'fetchrow_hashref not implemented', 2 }