Changeset 1358

Show
Ignore:
Timestamp:
07/31/08 01:07:47 (5 months ago)
Author:
jtv
Message:

Fixed serious bug in PQXX_CHECK_THROWS

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1357 r1358  
     12008-07-31  Jeroen T. Vermeulen <jtv@xs4all.nl> 
     2 test/test085.cxx, test/test092.cxx: 
     3  - Converted to test framework. 
     4 test/test_helpers.hxx, test/unit/test_test_helpers.cxx: 
     5  - PQXX_CHECK_THROWS() swallowed all std::exception throws! 
    162008-07-25  Jeroen T. Vermeulen <jtv@xs4all.nl> 
    27 src/connection_base.cxx: 
  • trunk/test/test_helpers.hxx

    r1354 r1358  
    148148// Verify that variable has the expected value. 
    149149#define PQXX_CHECK_EQUAL(actual, expected, desc) \ 
    150         if (!(expected == actual)) throw pqxx::test::test_failure( \ 
     150        if (!((expected) == (actual))) throw pqxx::test::test_failure( \ 
    151151                __FILE__, \ 
    152152                __LINE__, \ 
     
    158158// Verify that two values are not equal. 
    159159#define PQXX_CHECK_NOT_EQUAL(value1, value2, desc) \ 
    160         if (!(value1 != value2)) throw pqxx::test::test_failure( \ 
     160        if (!((value1) != (value2))) throw pqxx::test::test_failure( \ 
    161161                __FILE__, \ 
    162162                __LINE__, \ 
     
    174174            pqxx_check_throws_failed = false; \ 
    175175          } \ 
    176           catch (const exception_type &) {} \ 
    177           catch (const PGSTD::exception &e) \ 
    178           { \ 
    179             throw pqxx::test::test_failure( \ 
    180                 __FILE__, \ 
    181                 __LINE__, \ 
    182                 PGSTD::string(desc) + " " \ 
    183                 "(" #action ": " \ 
    184                 "expected=" #exception_type ", " \ 
    185                 "threw='" + e.what() + "')"); \ 
    186           } \ 
     176          catch (const PGSTD::exception &e) {} \ 
    187177          catch (...) \ 
    188178          { \ 
  • trunk/test/unit/test_test_helpers.cxx

    r1291 r1358  
    77 
    88void empty() {} 
     9 
     10void test_exception() 
     11{ 
     12  PQXX_CHECK_THROWS( 
     13        throw exception(), 
     14        exception, 
     15        "Plain exception not handled properly by PQXX_CHECK_THROWS.") 
     16} 
    917 
    1018void test_simple_failure()