Ignore:
Timestamp:
08/22/10 15:07:44 (21 months ago)
Author:
MichaelTempest
Message:

Item2286: Give more helpful error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/lib/Unit/TestCase.pm

    r8249 r8652  
    266266sub assert_str_equals { 
    267267    my ( $this, $expected, $got, $mess ) = @_; 
    268     $this->assert_not_null($expected); 
    269     $this->assert_not_null($got); 
     268    $this->assert_not_null( $expected, "Expected value may not be null" ); 
     269    $this->assert_not_null( $got, 
     270        $mess || "Expected:'$expected'\n But got null value\n" ); 
    270271    $this->assert( $expected eq $got, 
    271272        $mess || "Expected:'$expected'\n But got:'$got'\n" ); 
     
    282283sub assert_str_not_equals { 
    283284    my ( $this, $expected, $got, $mess ) = @_; 
    284     $this->assert_not_null($expected); 
    285     $this->assert_not_null($got); 
     285    $this->assert_not_null($expected, "Expected value may not be null"); 
     286    $this->assert_not_null( $got, 
     287        $mess || "Expected:'$expected'\n But got null value\n" ); 
    286288    $this->assert( $expected ne $got, 
    287289        $mess || "Expected:'$expected'\n And got:'$got'\n" ); 
     
    298300sub assert_num_equals { 
    299301    my ( $this, $expected, $got, $mess ) = @_; 
    300     $this->assert_not_null($expected); 
    301     $this->assert_not_null($got); 
     302    $this->assert_not_null( $expected, "Expected value may not be null" ); 
     303    $this->assert_not_null( $got, 
     304        $mess || "Expected:'$expected'\n But got null value\n" ); 
    302305    $this->assert( $expected == $got, 
    303306        $mess || "Expected:'$expected'\n But got:'$got'\n" ); 
     
    314317sub assert_num_not_equals { 
    315318    my ( $this, $expected, $got, $mess ) = @_; 
    316     $this->assert_not_null($expected); 
    317     $this->assert_not_null($got); 
     319    $this->assert_not_null( $expected, "Expected value may not be null" ); 
     320    $this->assert_not_null( $got, 
     321        $mess || "Expected:'$expected'\n But got null value\n" ); 
    318322    $this->assert( $expected != $got, 
    319323        $mess || "Expected:'$expected'\n But got:'$got'\n" ); 
     
    330334sub assert_matches { 
    331335    my ( $this, $expected, $got, $mess ) = @_; 
    332     $this->assert_not_null($expected); 
    333     $this->assert_not_null($got); 
     336    $this->assert_not_null( $expected, "Expected value may not be null" ); 
     337    $this->assert_not_null( $got, 
     338        $mess || "Expected:'$expected'\n But got null value\n" ); 
    334339    if ( $] < 5.010 ) { 
    335340 
     
    358363sub assert_does_not_match { 
    359364    my ( $this, $expected, $got, $mess ) = @_; 
    360     $this->assert_not_null($expected); 
    361     $this->assert_not_null($got); 
     365    $this->assert_not_null( $expected, "Expected value may not be null" ); 
     366    $this->assert_not_null( $got, 
     367        $mess || "Expected:'$expected'\n But got null value\n" ); 
    362368    if ( $] < 5.010 ) { 
    363369 
Note: See TracChangeset for help on using the changeset viewer.