[Bps-public-commit] r18324 - in Net-Google-Code/branches/write: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Feb 10 07:47:35 EST 2009


Author: sunnavy
Date: Tue Feb 10 07:47:34 2009
New Revision: 18324

Modified:
   Net-Google-Code/branches/write/   (props changed)
   Net-Google-Code/branches/write/t/02.issue.t

Log:
 r19753 at sunnavys-mb:  sunnavy | 2009-02-10 20:45:09 +0800
 tests for labels_array


Modified: Net-Google-Code/branches/write/t/02.issue.t
==============================================================================
--- Net-Google-Code/branches/write/t/02.issue.t	(original)
+++ Net-Google-Code/branches/write/t/02.issue.t	Tue Feb 10 07:47:34 2009
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 15;
+use Test::More tests => 17;
 use Test::MockModule;
 
 # $content is a real page: http://code.google.com/p/chromium/issues/detail?id=14
@@ -59,6 +59,8 @@
     Foo    => 'Bar-Baz', # this is one we fake, for more than 1 hyphen
 );
 
+my @labels_array = map { $_ . '-' . ( $labels{$_} || '' ) } sort keys %labels;
+
 for my $item ( qw/id summary description owner cc reporter status closed/ ) {
     if ( defined $info{$item} ) {
         is ( $ticket->$item, $info{$item}, "$item is extracted" );
@@ -69,6 +71,16 @@
 }
 
 is_deeply( $ticket->labels, \%labels, 'labels is extracted' );
+is_deeply(
+    [ $ticket->labels_array ],
+    \@labels_array,
+    'labels_array without labels arg'
+);
+is_deeply(
+    [ $ticket->labels_array( labels => { Type => 'foo', Label => 'bar' } ) ],
+    [ 'Label-bar', 'Type-foo' ],
+    'labels_array with labels arg'
+);
 
 is( scalar @{$ticket->comments}, 50, 'comments are extracted' );
 is( $ticket->comments->[0]->sequence, 1, 'sequence of 1st comments is 1' );



More information about the Bps-public-commit mailing list