From 6b980e3c195e2f29a5c845010231f8ae2da00f09 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 16 Oct 2015 21:09:36 +0100 Subject: Exclude test shouldn't happen error handling from coverage --- slicer/test/conversions.cpp | 4 ++++ slicer/test/helpers.cpp | 6 ++++++ 2 files changed, 10 insertions(+) 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 } } -- cgit v1.2.3