From 0768666d941af819c8fc20fc872609d4107c7bd2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 2 Dec 2015 21:21:57 +0000 Subject: Propergate connection error details into DB::Error and add test --- libpqpp/unittests/testpq.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libpqpp/unittests') diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp index cf366cb..5dc4b2d 100644 --- a/libpqpp/unittests/testpq.cpp +++ b/libpqpp/unittests/testpq.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "../error.h" class StandardMockDatabase : public PQ::Mock { public: @@ -169,3 +170,8 @@ BOOST_AUTO_TEST_CASE( insertId ) BOOST_AUTO_TEST_SUITE_END(); +BOOST_AUTO_TEST_CASE( connfail ) +{ + BOOST_REQUIRE_THROW(DB::ConnectionFactory::createNew("postgresql", "host=localhost user=no"), PQ::ConnectionError); +} + -- cgit v1.2.3