mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Cleanup of unused functions
The cleanup also found out that custom translation for std-derived exceptions test wasn't running properly, and fixed that. We cannot enable the warning globally, because the tests contain some functions that are unused by design -- e.g. when checking stringification priority of StringMaker vs range fallback and so on.
This commit is contained in:
parent
b84067ea6f
commit
198713e5dc
@ -88,7 +88,6 @@ namespace Catch {
|
|||||||
class NoColourImpl : public ColourImpl {
|
class NoColourImpl : public ColourImpl {
|
||||||
public:
|
public:
|
||||||
NoColourImpl( IStream* stream ): ColourImpl( stream ) {}
|
NoColourImpl( IStream* stream ): ColourImpl( stream ) {}
|
||||||
static bool useColourOnPlatform() { return true; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void use( Colour::Code ) const override {}
|
void use( Colour::Code ) const override {}
|
||||||
|
@ -108,11 +108,6 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printSourceInfo() const {
|
|
||||||
stream << colourImpl->guardColour( tapDimColour )
|
|
||||||
<< result.getSourceInfo() << ':';
|
|
||||||
}
|
|
||||||
|
|
||||||
void printResultType(StringRef passOrFail) const {
|
void printResultType(StringRef passOrFail) const {
|
||||||
if (!passOrFail.empty()) {
|
if (!passOrFail.empty()) {
|
||||||
stream << passOrFail << ' ' << counter << " -";
|
stream << passOrFail << ' ' << counter << " -";
|
||||||
|
@ -33,15 +33,6 @@ namespace {
|
|||||||
double double_pi = 3.1415926535;
|
double double_pi = 3.1415926535;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestDef {
|
|
||||||
TestDef& operator + (const std::string&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TestDef& operator[](const std::string&) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char* returnsConstNull() { return nullptr; }
|
static const char* returnsConstNull() { return nullptr; }
|
||||||
static char* returnsNull() { return nullptr; }
|
static char* returnsNull() { return nullptr; }
|
||||||
|
|
||||||
@ -53,9 +44,6 @@ namespace {
|
|||||||
// Equality tests
|
// Equality tests
|
||||||
TEST_CASE( "Equality checks that should succeed" )
|
TEST_CASE( "Equality checks that should succeed" )
|
||||||
{
|
{
|
||||||
TestDef td;
|
|
||||||
td + "hello" + "hello";
|
|
||||||
|
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
REQUIRE( data.int_seven == 7 );
|
REQUIRE( data.int_seven == 7 );
|
||||||
|
@ -39,7 +39,7 @@ namespace {
|
|||||||
explicit CustomException(const std::string& msg)
|
explicit CustomException(const std::string& msg)
|
||||||
: m_msg(msg) {}
|
: m_msg(msg) {}
|
||||||
|
|
||||||
std::string getMessage() const {
|
std::string const& getMessage() const {
|
||||||
return m_msg;
|
return m_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +51,12 @@ namespace {
|
|||||||
public:
|
public:
|
||||||
explicit CustomStdException(const std::string& msg)
|
explicit CustomStdException(const std::string& msg)
|
||||||
: m_msg(msg) {}
|
: m_msg(msg) {}
|
||||||
~CustomStdException() noexcept override {}
|
~CustomStdException() noexcept override = default;
|
||||||
|
|
||||||
std::string getMessage() const {
|
CustomStdException( CustomStdException const& ) = default;
|
||||||
|
CustomStdException& operator=( CustomStdException const& ) = default;
|
||||||
|
|
||||||
|
std::string const& getMessage() const {
|
||||||
return m_msg;
|
return m_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +140,7 @@ TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" ) {
|
TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" ) {
|
||||||
throw CustomException( "custom std exception" );
|
throw CustomStdException( "custom std exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" ) {
|
TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user