From: Karen Etheridge Date: Thu, 25 Nov 2010 22:02:19 +0000 (-0800) Subject: explicitly test that shift returns undef and does not die on an empty array X-Git-Tag: 1.9900~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=805e018dc889a86a74b6a9479b686a1c993d66a1;p=gitmo%2FMoose.git explicitly test that shift returns undef and does not die on an empty array --- diff --git a/t/070_native_traits/010_trait_array.t b/t/070_native_traits/010_trait_array.t index 8774ffa..decf151 100644 --- a/t/070_native_traits/010_trait_array.t +++ b/t/070_native_traits/010_trait_array.t @@ -269,6 +269,11 @@ sub run_tests { ok( $obj->is_empty, 'values is empty after call to clear' ); + is( exception { + is( $obj->shift, undef, + 'shift returns undef on an empty array' ); + }, undef, 'shifted from an empty array and lived' ); + $obj->set( 0 => 42 ); like( exception { $obj->clear(50) }, qr/Cannot call clear with any arguments/, 'throws an error when clear is called with an argument' );