1use Test::More; 2use strict; use warnings; 3 4use Lowu 'array'; 5 6my $arr = array(qw/a b b c d c c e b/); 7my $squished = $arr->squished; 8is_deeply [ $squished->all ], [ qw/a b c d c e b/ ], 'squished ok'; 9is_deeply [ $arr->squish->all ], [ $squished->all ], 'squish alias ok'; 10 11$arr = array('a', 'b', undef, 'b', undef, undef, 'c'); 12is_deeply [ $arr->squished->all ], [ 'a', 'b', undef, 'b', undef, 'c' ], 13 'squished with (middle) undefs ok'; 14 15$arr = array(undef, undef, 'a', 'b'); 16is_deeply [ $arr->squished->all ], [ undef, 'a', 'b' ], 17 'squished with (leading) undefs ok'; 18 19$arr = array(undef, 'a', 'a', 'b'); 20is_deeply [ $arr->squished->all ], [ undef, 'a', 'b' ], 21 'squished with leading single undef ok'; 22 23$arr = array('a', 'b', 'c'); 24is_deeply [ $arr->squished->all ], [ 'a', 'b', 'c' ], 25 'squished (no squished values) ok'; 26 27ok array->squished->is_empty, 'squished on empty array ok'; 28 29done_testing 30