Changeset 21988

Show
Ignore:
Timestamp:
08/21/08 10:03:14 (3 months ago)
Author:
moritz
Message:

[t/spec] brought a bit sanity to wrapping.t. Needs more.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • t/spec/S06-advanced_subroutine_features/wrapping.t

    r21387 r21988  
    77# FIXME: There is probably a better way, perhapse using try/CATCH, but I was 
    88# unable to figure out the try/CATCH syntax. 
     9# All these tests should be re-written in terms of lives_ok(); 
    910sub nok_error( $error, $message? ) { 
    1011    if ( $error ) { 
     
    1819is( hi, "Hi", "Basic sub." ); 
    1920my $handle; 
    20 try{ $handle = &hi.wrap({ callsame ~ " there" }) }; 
    21 nok_error( $!, "Wrapping seems to have failed." ); 
     21lives_ok( { $handle = &hi.wrap({ callsame ~ " there" }) },  
     22        "Basic wrapping works "); 
    2223 
    2324ok( $handle, "Recieved handle for unwrapping." ); 
     
    2526 
    2627#unwrap the handle 
    27 try{ ok( $handle = &hi.unwrap( $handle ), "unwrap the function" )}; 
    28 nok_error( $!, "Unwrapping seems to have failed" ); 
     28lives_ok { $handle = &hi.unwrap( $handle )}, "unwrap the function"; 
    2929 
    3030is( hi, "Hi", "Function is no longer wrapped." ); 
     
    6262is( functionA, 'z', "Sanity." ); 
    6363my $middle; 
    64 try{ ok( $middle = &functionA.wrap({ return 'y' ~ callsame }))}; 
     64try { ok( $middle = &functionA.wrap({ return 'y' ~ callsame }))}; 
    6565nok_error( $!, "Wrapping failed." ); 
    6666is( functionA, "yz", "Middle wrapper sanity." ); 
    67 try{ ok( &functionA.wrap({ return 'x' ~ callsame }))}; 
     67try { ok( &functionA.wrap({ return 'x' ~ callsame }))}; 
    6868nok_error( $!, "Wrapping failed." ); 
    6969is( functionA, "xyz", "three wrappers sanity." ); 
    70 try{ ok( &functionA.unwrap( $middle ))}; 
     70try { ok( &functionA.unwrap( $middle ))}; 
    7171nok_error( $!, "Failed to unwrap the middle wrapper." ); 
    7272is( functionA, "xz", "First wrapper and final function only, middle removed." ); 
     
    7878is( functionB, "xxx", "Sanity" ); 
    7979{ 
    80     try{ 
     80    try { 
    8181        temp &functionB.wrap({ return 'yyy' }); 
    8282    }; 
     
    9191#Redirecting 
    9292 
    93  
    94  
    95  
    96