Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-08 18:20:49 +0200
committerMartin Hořeňovský2019-09-08 18:20:49 +0200
commit293012a002ef5351adbfcc0cbf7cdfdc93aed115 (patch)
treec178c44ce7b0dd94564ad3887c52b1e07ad7e328
parente2b3443fe7211f265c95f878d06d8fd4abf38f27 (diff)
downloadcatch3-293012a002ef5351adbfcc0cbf7cdfdc93aed115.tar.gz
Inline SourceLineInfo::empty definition
-rw-r--r--docs/deprecations.md5
-rw-r--r--include/internal/catch_common.cpp3
-rw-r--r--include/internal/catch_common.h2
-rw-r--r--include/reporters/catch_reporter_console.cpp9
-rw-r--r--include/reporters/catch_reporter_teamcity.hpp3
5 files changed, 11 insertions, 11 deletions
diff --git a/docs/deprecations.md b/docs/deprecations.md
index 0489e1ff..77830298 100644
--- a/docs/deprecations.md
+++ b/docs/deprecations.md
@@ -39,6 +39,11 @@ apart from writing it out for `--list-tests -v high`.
Because it isn't actually used nor documented, and brings complications
to Catch2's internals, description support will be removed.
+### SourceLineInfo::empty()
+
+There should be no reason to ever have an empty `SourceLineInfo`, so the
+method will be removed.
+
## Planned changes
diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp
index b2fca4c4..790acbe5 100644
--- a/include/internal/catch_common.cpp
+++ b/include/internal/catch_common.cpp
@@ -15,9 +15,6 @@
namespace Catch {
- bool SourceLineInfo::empty() const noexcept {
- return file[0] == '\0';
- }
bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
}
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
index e4745622..5e097fbf 100644
--- a/include/internal/catch_common.h
+++ b/include/internal/catch_common.h
@@ -57,7 +57,7 @@ namespace Catch {
SourceLineInfo( SourceLineInfo&& ) noexcept = default;
SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;
- bool empty() const noexcept;
+ bool empty() const noexcept { return file[0] == '\0'; }
bool operator == ( SourceLineInfo const& other ) const noexcept;
bool operator < ( SourceLineInfo const& other ) const noexcept;
diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp
index e38e34cf..55b0c9ed 100644
--- a/include/reporters/catch_reporter_console.cpp
+++ b/include/reporters/catch_reporter_console.cpp
@@ -530,11 +530,10 @@ void ConsoleReporter::printTestCaseAndSectionHeader() {
SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
- if (!lineInfo.empty()) {
- stream << getLineOfChars<'-'>() << '\n';
- Colour colourGuard(Colour::FileName);
- stream << lineInfo << '\n';
- }
+
+ stream << getLineOfChars<'-'>() << '\n';
+ Colour colourGuard(Colour::FileName);
+ stream << lineInfo << '\n';
stream << getLineOfChars<'.'>() << '\n' << std::endl;
}
diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index eca2885c..47b7e4aa 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -183,8 +183,7 @@ namespace Catch {
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
- if( !lineInfo.empty() )
- os << lineInfo << "\n";
+ os << lineInfo << "\n";
os << getLineOfChars<'.'>() << "\n\n";
}