view Exception/TestSQLException.cpp @ 73:c9447697609f

Fixed some issues with raise. 100% function code coverage for Exceptions.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Thu, 31 Jan 2013 20:33:01 +0100
parents
children
line wrap: on
line source

#include "Exception/SQLException.hpp"

#include <QtSql/QSqlQuery>

#include "TestFramework.hpp"

BOOST_AUTO_TEST_CASE( Create )
{
  try {
    throw SQLException("Hello");
  }
  catch (SQLException & e) {
    BOOST_REQUIRE_EQUAL(e.toString(), "Hello");
    BOOST_REQUIRE_THROW(e.raise(), SQLException);
  }
}

BOOST_AUTO_TEST_CASE( CreateWithSql )
{
  try {
    throw SQLException(QSqlQuery());
  }
  catch (SQLException & e) {
    BOOST_REQUIRE_THROW(e.raise(), SQLException);
  }
}