diff options
| author | Martin Hořeňovský | 2022-05-02 12:13:29 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-05-02 21:32:24 +0200 |
| commit | 198713e5dc2c1adc8f28bdd43c9e66a679cf8d8d (patch) | |
| tree | 2d5ef098b8532f88f3134d0072bca86d6d1a3480 /tests/SelfTest/UsageTests/Exception.tests.cpp | |
| parent | b84067ea6f566fdfecadcef4b2c938698e1c21cc (diff) | |
| download | catch3-198713e5dc2c1adc8f28bdd43c9e66a679cf8d8d.tar.gz | |
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.
Diffstat (limited to 'tests/SelfTest/UsageTests/Exception.tests.cpp')
| -rw-r--r-- | tests/SelfTest/UsageTests/Exception.tests.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/SelfTest/UsageTests/Exception.tests.cpp b/tests/SelfTest/UsageTests/Exception.tests.cpp index 9b6d2a58..e93cf919 100644 --- a/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -39,7 +39,7 @@ namespace { explicit CustomException(const std::string& msg) : m_msg(msg) {} - std::string getMessage() const { + std::string const& getMessage() const { return m_msg; } @@ -51,9 +51,12 @@ namespace { public: explicit CustomStdException(const std::string& 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; } @@ -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]" ) { - throw CustomException( "custom std exception" ); + throw CustomStdException( "custom std exception" ); } TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" ) { |