summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@ubuntu.com>2011-12-09 13:03:46 -0800
committerChase Douglas <chase.douglas@ubuntu.com>2011-12-09 13:03:46 -0800
commit934da7636d0cc811600c2dd73c6cd386f0851e25 (patch)
tree32ae1d08eeba37a283f8965e1f6d1e5f512194d2
parentc0b553ebe1be0bf4c2ebffc1582a0e07f40aaa5a (diff)
Throw runtime_error if Test::SetUp fails to open connection to server
gtest treats exceptions as test failures, so this should have the same result but is a cleaner implementation.
-rw-r--r--src/test.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test.cpp b/src/test.cpp
index 565c321..199505f 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -21,6 +21,8 @@
#include "xorg/gtest/test.h"
+#include <stdexcept>
+
#include <X11/Xlib.h>
struct xorg::testing::Test::Private {
@@ -33,7 +35,8 @@ xorg::testing::Test::Test() : d_(new Private) {
void xorg::testing::Test::SetUp() {
d_->display = XOpenDisplay(NULL);
- ASSERT_TRUE(d_->display != NULL) << "Failed to open connection to display";
+ if (!d_->display)
+ throw std::runtime_error("Failed to open connection to display");
}
void xorg::testing::Test::TearDown() {