mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Do not write singular characters into stream as C-strings
This commit is contained in:
parent
6e8d769775
commit
789f3591ef
@ -268,7 +268,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {
|
friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {
|
||||||
return os << duration.value() << " " << duration.unitsAsString();
|
return os << duration.value() << ' ' << duration.unitsAsString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // end anon namespace
|
} // end anon namespace
|
||||||
@ -300,9 +300,9 @@ public:
|
|||||||
headerCols += Column(info.name).width(static_cast<std::size_t>(info.width - 2));
|
headerCols += Column(info.name).width(static_cast<std::size_t>(info.width - 2));
|
||||||
headerCols += spacer;
|
headerCols += spacer;
|
||||||
}
|
}
|
||||||
m_os << headerCols << "\n";
|
m_os << headerCols << '\n';
|
||||||
|
|
||||||
m_os << Catch::getLineOfChars<'-'>() << "\n";
|
m_os << Catch::getLineOfChars<'-'>() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void close() {
|
void close() {
|
||||||
@ -327,7 +327,7 @@ public:
|
|||||||
tp.open();
|
tp.open();
|
||||||
if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {
|
if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {
|
||||||
tp.m_currentColumn = -1;
|
tp.m_currentColumn = -1;
|
||||||
tp.m_os << "\n";
|
tp.m_os << '\n';
|
||||||
}
|
}
|
||||||
tp.m_currentColumn++;
|
tp.m_currentColumn++;
|
||||||
|
|
||||||
@ -336,15 +336,15 @@ public:
|
|||||||
? std::string(colInfo.width - (strSize + 2), ' ')
|
? std::string(colInfo.width - (strSize + 2), ' ')
|
||||||
: std::string();
|
: std::string();
|
||||||
if (colInfo.justification == ColumnInfo::Left)
|
if (colInfo.justification == ColumnInfo::Left)
|
||||||
tp.m_os << colStr << padding << " ";
|
tp.m_os << colStr << padding << ' ';
|
||||||
else
|
else
|
||||||
tp.m_os << padding << colStr << " ";
|
tp.m_os << padding << colStr << ' ';
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {
|
friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {
|
||||||
if (tp.m_currentColumn > 0) {
|
if (tp.m_currentColumn > 0) {
|
||||||
tp.m_os << "\n";
|
tp.m_os << '\n';
|
||||||
tp.m_currentColumn = -1;
|
tp.m_currentColumn = -1;
|
||||||
}
|
}
|
||||||
return tp;
|
return tp;
|
||||||
@ -449,7 +449,7 @@ void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {
|
|||||||
void ConsoleReporter::benchmarkFailed(std::string const& error) {
|
void ConsoleReporter::benchmarkFailed(std::string const& error) {
|
||||||
Colour colour(Colour::Red);
|
Colour colour(Colour::Red);
|
||||||
(*m_tablePrinter)
|
(*m_tablePrinter)
|
||||||
<< "Benchmark failed (" << error << ")"
|
<< "Benchmark failed (" << error << ')'
|
||||||
<< ColumnBreak() << RowBreak();
|
<< ColumnBreak() << RowBreak();
|
||||||
}
|
}
|
||||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||||
|
Loading…
Reference in New Issue
Block a user