diff options
| author | Martin Hořeňovský | 2020-08-01 20:32:26 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-08-03 23:40:14 +0200 |
| commit | e7aa432850c34557e857d8675bff9b3f03de41b8 (patch) | |
| tree | dc270fc1f042f852ce624256282ce6435e602015 /src/catch2/interfaces | |
| parent | 81aa2d5582444ff79eedec7c098c096b6f8aa0cf (diff) | |
| download | catch3-e7aa432850c34557e857d8675bff9b3f03de41b8.tar.gz | |
Split TextFlow out from Clara
Now that it has its own header, various reporter TUs that want to
format text do not have to also include Clara. Together with
outlining implementations from a header into a separate TU, this
has noticeably improved the compilation times of the testing impl.
As part of this split, I also implemented some improvements to the
TextFlow code in comparison to the upstream code. These are:
* Replaced the `Spacer` type with a free function that constructs
special `Column` that does the same thing.
* Generic performance improvements, such as eliminating needless
allocations, reserving space in needed allocations, and using smarter
algorithms in some places.
* Because `Column` only ever stored 1 string in its vector, it now
holds the string directly instead.
Diffstat (limited to 'src/catch2/interfaces')
| -rw-r--r-- | src/catch2/interfaces/catch_interfaces_reporter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/catch2/interfaces/catch_interfaces_reporter.cpp b/src/catch2/interfaces/catch_interfaces_reporter.cpp index 3d1a01c5..7e4dd9ef 100644 --- a/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -9,11 +9,13 @@ #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/catch_config.hpp> #include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_console_width.hpp> #include <catch2/catch_message.hpp> #include <catch2/internal/catch_list.hpp> -#include <catch2/internal/catch_text.hpp> +#include <catch2/internal/catch_textflow.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_textflow.hpp> #include <algorithm> #include <iomanip> @@ -117,15 +119,15 @@ namespace Catch { for (auto const& desc : descriptions) { if (config.verbosity() == Verbosity::Quiet) { Catch::cout() - << Column(desc.name) + << TextFlow::Column(desc.name) .indent(2) .width(5 + maxNameLen) << '\n'; } else { Catch::cout() - << Column(desc.name + ":") + << TextFlow::Column(desc.name + ":") .indent(2) .width(5 + maxNameLen) - + Column(desc.description) + + TextFlow::Column(desc.description) .initialIndent(0) .indent(2) .width(CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8) @@ -149,12 +151,12 @@ namespace Catch { : Colour::None; Colour colourGuard(colour); - Catch::cout() << Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; + Catch::cout() << TextFlow::Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; if (config.verbosity() >= Verbosity::High) { - Catch::cout() << Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; + Catch::cout() << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; } if (!testCaseInfo.tags.empty() && config.verbosity() > Verbosity::Quiet) { - Catch::cout() << Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; + Catch::cout() << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; } } @@ -176,7 +178,7 @@ namespace Catch { ReusableStringStream rss; rss << " " << std::setw(2) << tagCount.count << " "; auto str = rss.str(); - auto wrapper = Column(tagCount.all()) + auto wrapper = TextFlow::Column(tagCount.all()) .initialIndent(0) .indent(str.size()) .width(CATCH_CONFIG_CONSOLE_WIDTH - 10); |