summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-16 21:09:36 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-16 21:09:36 +0100
commit6b980e3c195e2f29a5c845010231f8ae2da00f09 (patch)
treea1939ec5ade5eef27f35c95b5daf5c621cc559cd
parentExclude BOOST_TEST_DONT_PRINT_LOG_VALUE code and help output (diff)
downloadslicer-6b980e3c195e2f29a5c845010231f8ae2da00f09.tar.bz2
slicer-6b980e3c195e2f29a5c845010231f8ae2da00f09.tar.xz
slicer-6b980e3c195e2f29a5c845010231f8ae2da00f09.zip
Exclude test shouldn't happen error handling from coverage
-rw-r--r--slicer/test/conversions.cpp4
-rw-r--r--slicer/test/helpers.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/slicer/test/conversions.cpp b/slicer/test/conversions.cpp
index 1ea6239..17ebfb0 100644
--- a/slicer/test/conversions.cpp
+++ b/slicer/test/conversions.cpp
@@ -41,7 +41,9 @@ namespace Slicer {
memset(&tm, 0, sizeof(struct tm));
auto end = strptime(in.c_str(), "%Y-%m-%d", &tm);
if (!end || *end) {
+ // LCOV_EXCL_START
throw std::runtime_error("Invalid iso-date string: " + in);
+ // LCOV_EXCL_STOP
}
return ::TestModule::IsoDate({
SHORT(tm.tm_year + 1900), SHORT(tm.tm_mon + 1), SHORT(tm.tm_mday)});
@@ -71,7 +73,9 @@ namespace Slicer {
memset(&tm, 0, sizeof(struct tm));
auto end = strptime(in.c_str(), "%Y-%b-%d %H:%M:%S", &tm);
if (!end || *end) {
+ // LCOV_EXCL_START
throw std::runtime_error("Invalid date string: " + in);
+ // LCOV_EXCL_STOP
}
return ::TestModule::DateTime({
SHORT(tm.tm_year + 1900), SHORT(tm.tm_mon + 1), SHORT(tm.tm_mday),
diff --git a/slicer/test/helpers.cpp b/slicer/test/helpers.cpp
index 58f47bc..73f3aa7 100644
--- a/slicer/test/helpers.cpp
+++ b/slicer/test/helpers.cpp
@@ -9,8 +9,10 @@ void
system(const std::string & cmd)
{
if (system(cmd.c_str())) {
+ // LCOV_EXCL_START
fprintf(stderr, "Failed to execute:\n\t%s\n", cmd.c_str());
throw std::runtime_error(cmd);
+ // LCOV_EXCL_STOP
}
}
@@ -32,7 +34,9 @@ loadlib(const boost::filesystem::path & so)
{
auto handle = dlopen(so.string().c_str(), RTLD_NOW | RTLD_GLOBAL);
if (!handle) {
+ // LCOV_EXCL_START
throw std::runtime_error(dlerror());
+ // LCOV_EXCL_STOP
}
return handle;
}
@@ -41,7 +45,9 @@ void
closelib(void * handle)
{
if (dlclose(handle)) {
+ // LCOV_EXCL_START
throw std::runtime_error(dlerror());
+ // LCOV_EXCL_STOP
}
}