autoboxing
[gitmo/Moose-Autobox.git] / t / 004_list_compressions.t
index d97775f..ebbaef4 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 5;
 
 BEGIN {
     use_ok('Moose::Autobox');
@@ -19,4 +19,20 @@ is_deeply(
 is_deeply(
 [ 1 .. 5 ]->map(sub { $_ * $_ })->do(sub { $_->zip($_) }),
 [ [1, 1], [4, 4], [9, 9], [16, 16], [25, 25] ],
-'... got the expected return values');
\ No newline at end of file
+'... got the expected return values');
+
+is( # sprintf an array ...
+[ 1 .. 5 ]->sprintf("%d -> %d -> %d"),
+'1 -> 2 -> 3',
+'... got the sprintf-ed values');
+
+is( # sprintf an array ...
+[ 1 .. 5 ]->do(sub {
+    $_->sprintf(
+        $_->keys
+          ->map(sub { '%d (' . $_ . ')' })
+          ->join(' -> '))
+}),
+'1 (0) -> 2 (1) -> 3 (2) -> 4 (3) -> 5 (4)',
+'... got a more elaboratly sprintf-ed values');
+