mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Inline SourceLineInfo::empty definition
This commit is contained in:
parent
e2b3443fe7
commit
293012a002
@ -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
|
Because it isn't actually used nor documented, and brings complications
|
||||||
to Catch2's internals, description support will be removed.
|
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
|
## Planned changes
|
||||||
|
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
bool SourceLineInfo::empty() const noexcept {
|
|
||||||
return file[0] == '\0';
|
|
||||||
}
|
|
||||||
bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
|
bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
|
||||||
return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
|
return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace Catch {
|
|||||||
SourceLineInfo( SourceLineInfo&& ) noexcept = default;
|
SourceLineInfo( SourceLineInfo&& ) noexcept = default;
|
||||||
SourceLineInfo& operator = ( 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;
|
||||||
bool operator < ( SourceLineInfo const& other ) const noexcept;
|
bool operator < ( SourceLineInfo const& other ) const noexcept;
|
||||||
|
|
||||||
|
@ -530,11 +530,10 @@ void ConsoleReporter::printTestCaseAndSectionHeader() {
|
|||||||
|
|
||||||
SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
|
SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
|
||||||
|
|
||||||
if (!lineInfo.empty()) {
|
|
||||||
stream << getLineOfChars<'-'>() << '\n';
|
stream << getLineOfChars<'-'>() << '\n';
|
||||||
Colour colourGuard(Colour::FileName);
|
Colour colourGuard(Colour::FileName);
|
||||||
stream << lineInfo << '\n';
|
stream << lineInfo << '\n';
|
||||||
}
|
|
||||||
stream << getLineOfChars<'.'>() << '\n' << std::endl;
|
stream << getLineOfChars<'.'>() << '\n' << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +183,7 @@ namespace Catch {
|
|||||||
|
|
||||||
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
|
SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
|
||||||
|
|
||||||
if( !lineInfo.empty() )
|
os << lineInfo << "\n";
|
||||||
os << lineInfo << "\n";
|
|
||||||
os << getLineOfChars<'.'>() << "\n\n";
|
os << getLineOfChars<'.'>() << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user