=================================================================== RCS file: /cvs/HOPE/Net-OpenAMD/t/network_tests.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HOPE/Net-OpenAMD/t/network_tests.t 2010/06/26 17:50:40 1.3 +++ HOPE/Net-OpenAMD/t/network_tests.t 2010/06/27 01:52:33 1.4 @@ -1,7 +1,7 @@ #!perl package NetworkTests; -# $AFresh1: network_tests.t,v 1.2 2010/06/26 16:47:01 andrew Exp $ +# $AFresh1: network_tests.t,v 1.3 2010/06/26 16:50:40 andrew Exp $ use strict; use warnings; @@ -32,32 +32,79 @@ my %tests = ( location => [ { args => undef, - expect => {}, + expect => [ + { 'y' => '83.1452331542969', + 'area' => 'Engressia', + 'time' => 2387, + 'user' => 12983, + 'x' => '46.7369918823242', + 'button' => 'False' + } + ], }, ], speakers => [ { args => undef, - expect => {}, + expect => [ + { 'name' => 'Johnny', + 'bio' => 'Johnny\'s bio' + }, + ], }, ], talks => [ { args => undef, - expect => {}, + expect => [ + { 'speakers' => [ 'Judas', 'JohnnyX' ], + 'interests' => [ 'media', 'crypto' ], + 'time' => '2008/7/18 13:00:00', + 'track' => 'Hooper', + 'title' => 'Ancient Egyptian Music and DRM', + 'abstract' => + 'A discussion of the development of musical notation, which was designed as a means of reproducing music while making it impossible for the general public to perform without permission.' + } + ], }, ], interests => [ { args => undef, - expect => {}, + expect => [ + 'new tech', 'activism', + 'radio', 'lockpicking', + 'crypto', 'privacy', + 'ethics', 'telephones', + 'social engineering', 'hacker spaces', + 'hardware hacking', 'nostalgia', + 'communities', 'science', + 'government', 'network security', + 'malicious software', 'pen testing', + 'web', 'niche hacks', + 'media', + ], }, ], users => [ { args => undef, - expect => {}, + expect => [ + { 'name' => 'JohnnyX', + 'x' => '32.54091324', + 'y' => '54.10958384', + 'interests' => [ + 'new tech', 'radio', + 'lockpicking', 'crypto', + 'telephones', 'social engineering', + 'hacker spaces', 'hardware hacking', + 'nostalgia', 'communities', + 'science', 'network security', + 'malicious software', 'pen testing' + ], + } + ] }, ], stats => [ { args => undef, - expect => {}, + expect => qr/^Unused \s feature/xms, }, ], ); @@ -67,8 +114,16 @@ no warnings 'uninitialized'; my $result; eval { $result = $amd->$method( $test->{args} ) }; - is( $@, undef, "AMD->$method($test->{args})" ); - is( $result, $test->{expect}, 'got expected result' ); + if ( ref $test->{expect} eq 'Regexp' ) { + like( $@, $test->{expect}, "AMD->$method($test->{args})" ); + } + elsif ( ref $test->{expect} ) { + is( $@, '', "AMD->$method($test->{args})" ); + is_deeply( $result, $test->{expect}, 'got expected result' ); + } + else { + is( $@, $test->{expect}, "AMD->$method($test->{args})" ); + } } } }