[svn:PHP-Sandwich] rev 1000 - PHP-Sandwich/trunk/t

[email protected] 15 Apr 2005 21:37:23 -0000
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
Author: gschlossnagle
Date: Fri Apr 15 14:37:22 2005
New Revision: 1000

Modified:
   PHP-Sandwich/trunk/t/3.t
   PHP-Sandwich/trunk/t/4.t
   PHP-Sandwich/trunk/t/5.t
Log:
improve tests


Modified: PHP-Sandwich/trunk/t/3.t
==============================================================================
--- PHP-Sandwich/trunk/t/3.t	(original)
+++ PHP-Sandwich/trunk/t/3.t	Fri Apr 15 14:37:22 2005
@@ -1,7 +1,7 @@
 #!/opt/ecelerity/3rdParty/bin/perl 
 use strict;
 use ExtUtils::testlib;
-use Test::More tests => 7;
+use Test::More tests => 6;
 
 BEGIN {
     use_ok 'PHP' or die;
@@ -15,9 +15,4 @@
   'include PHP testing suite';
 my @list = ('I', 'AM', 'AN', 'ARRAY');
 ok my $newlist = $p->ident(\@list), 'Pass an AV into PHP, return an AV.';
-is scalar(@$newlist), scalar(@list), "Arrays are the same size.";
-my $match = 1;
-for(my $i = 0; $i < scalar @$newlist; $i++) {
-  if($newlist->[$i] ne $list[$i]) { $match = 0; }
-}
-is $match, 1, "Checking arrays are identical.";
+is_deeply $newlist, \@list, "Checking arrays are identical.";

Modified: PHP-Sandwich/trunk/t/4.t
==============================================================================
--- PHP-Sandwich/trunk/t/4.t	(original)
+++ PHP-Sandwich/trunk/t/4.t	Fri Apr 15 14:37:22 2005
@@ -15,9 +15,5 @@
 my $hash = { 'a' => 'alpha', 'b' => 'beta', 'c' => 'charlie' };
 ok my $arg = $p->ident($hash), "Pass a hash into PHP, recieve a hash back";
 
-my $broken = 0;
-foreach(keys %$arg) {
-  $broken = 1 if $hash->{$_} ne $arg->{$_};
-}
-is $broken, 0, "Checking the return hash matches the passed hash.";
+is_deeply $arg, $hash,  "Checking the return hash matches the passed hash.";
 

Modified: PHP-Sandwich/trunk/t/5.t
==============================================================================
--- PHP-Sandwich/trunk/t/5.t	(original)
+++ PHP-Sandwich/trunk/t/5.t	Fri Apr 15 14:37:22 2005
@@ -13,11 +13,4 @@
 ok $p->include('test.inc'), "including PHP testing functions.";
 my @list = ('I', 'AM', 'AN', ['NESTED', 'ARRAY']);
 ok my $arg = $p->ident(\@list), "Pass in a nested array and return it.";
-
-ok($arg->[0] eq 'I' && 
-   $arg->[1] eq 'AM' &&
-   $arg->[2] eq 'AN' &&
-   $arg->[3]->[0] eq 'NESTED' &&
-   $arg->[3]->[1] eq 'ARRAY',
-   "Testing that return array equals passed array.");
-
+is_deeply $arg, \@list, "Testing that return array equals passed array.";