From 56ec67626d674cb0bba142fc9b0a57b53b844a0f Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 15 Jun 2006 22:33:36 +0000 Subject: [PATCH] use Test::More::is_deeply instead of custom sub and implement check for simple inheritance in Asset classes --- t/Asset/Asset_diagnose.t | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/t/Asset/Asset_diagnose.t b/t/Asset/Asset_diagnose.t index 759e2ecdb..4b119f6cf 100644 --- a/t/Asset/Asset_diagnose.t +++ b/t/Asset/Asset_diagnose.t @@ -36,7 +36,7 @@ my $assetIds = $session->db->buildArrayRef("select distinct(assetId) from as my $assetDataIds = $session->db->buildArrayRef("select distinct(assetId) from assetData order by assetId"); ##This is a quick test to see if details of mismatch are required -my $noDetails = ok(compare_arrays($assetIds, $assetDataIds), "Checking asset vs assetData"); +my $noDetails = is_deeply($assetIds, $assetDataIds, "Checking asset vs assetData"); SKIP: { skip("No need for details", 1) if $noDetails; @@ -48,9 +48,9 @@ foreach my $asset ( @assets ) { eval "use $asset"; my $def = $asset->definition($session); my $tableName = $def->[0]->{tableName}; - my $classIds = $session->db->buildArrayRef("select distinct(assetId) from asset where className=? order by assetId", [$asset]); + my $classIds = $session->db->buildArrayRef("select distinct(assetId) from asset where className LIKE ? order by assetId", [$asset.'%']); my $tableIds = $session->db->buildArrayRef(sprintf("select distinct(assetId) from %s order by assetId", $tableName)); - my $skipDetails = ok(compare_arrays($classIds, $tableIds), + my $skipDetails = is_deeply($classIds, $tableIds, sprintf("Comparing assetIds for %s",$asset) ); SKIP: { @@ -58,13 +58,3 @@ foreach my $asset ( @assets ) { cmp_bag($classIds, $tableIds, "Checking asset vs table for $asset"); } } - -sub compare_arrays { - my ($first, $second) = @_; - no warnings; - return 0 unless @$first == @$second; - for (my $i=0; $i <=@$first; $i++) { - return 0 if $first->[$i] ne $second->[$i]; - } - return 1; -}