Changeset 21988
- Timestamp:
- 08/21/08 10:03:14 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S06-advanced_subroutine_features/wrapping.t
r21387 r21988 7 7 # FIXME: There is probably a better way, perhapse using try/CATCH, but I was 8 8 # unable to figure out the try/CATCH syntax. 9 # All these tests should be re-written in terms of lives_ok(); 9 10 sub nok_error( $error, $message? ) { 10 11 if ( $error ) { … … 18 19 is( hi, "Hi", "Basic sub." ); 19 20 my $handle; 20 try{ $handle = &hi.wrap({ callsame ~ " there" }) }; 21 nok_error( $!, "Wrapping seems to have failed.");21 lives_ok( { $handle = &hi.wrap({ callsame ~ " there" }) }, 22 "Basic wrapping works "); 22 23 23 24 ok( $handle, "Recieved handle for unwrapping." ); … … 25 26 26 27 #unwrap the handle 27 try{ ok( $handle = &hi.unwrap( $handle ), "unwrap the function" )}; 28 nok_error( $!, "Unwrapping seems to have failed" ); 28 lives_ok { $handle = &hi.unwrap( $handle )}, "unwrap the function"; 29 29 30 30 is( hi, "Hi", "Function is no longer wrapped." ); … … 62 62 is( functionA, 'z', "Sanity." ); 63 63 my $middle; 64 try { ok( $middle = &functionA.wrap({ return 'y' ~ callsame }))};64 try { ok( $middle = &functionA.wrap({ return 'y' ~ callsame }))}; 65 65 nok_error( $!, "Wrapping failed." ); 66 66 is( functionA, "yz", "Middle wrapper sanity." ); 67 try { ok( &functionA.wrap({ return 'x' ~ callsame }))};67 try { ok( &functionA.wrap({ return 'x' ~ callsame }))}; 68 68 nok_error( $!, "Wrapping failed." ); 69 69 is( functionA, "xyz", "three wrappers sanity." ); 70 try { ok( &functionA.unwrap( $middle ))};70 try { ok( &functionA.unwrap( $middle ))}; 71 71 nok_error( $!, "Failed to unwrap the middle wrapper." ); 72 72 is( functionA, "xz", "First wrapper and final function only, middle removed." ); … … 78 78 is( functionB, "xxx", "Sanity" ); 79 79 { 80 try {80 try { 81 81 temp &functionB.wrap({ return 'yyy' }); 82 82 }; … … 91 91 #Redirecting 92 92 93 94 95 96
