diff options
| author | Martin Hořeňovský | 2026-08-22 23:28:11 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-08-22 23:28:11 +0200 |
| commit | ef3a728265292e6a1dbec727b0099d3d8b3f6420 (patch) | |
| tree | 7c2ddb997a6a1fdbd1ad25edc18966ee63ebd4dd /src/catch2/catch_session.cpp | |
| parent | 69da66ee7370d7c249ba6f2a322a78dcdd623761 (diff) | |
| download | catch3-ef3a728265292e6a1dbec727b0099d3d8b3f6420.tar.gz | |
Don't store extra copy of all `TestCaseInfo*` in `TestRegistry`
We used to store a full vector of "views" of the registered test infos,
so that it can be retrieved externally. However, the only user of that
interface left was `Session`, specifically `Session::applyFilenameAsTags`.
By moving the adding of the filename tags into the `ITestCaseRegistry`
interface, we avoid storing the vector and make the initial test registration
faster.
The new code is ugly and shows a design/layering issue, but no worse than
the previous approach did.
Diffstat (limited to 'src/catch2/catch_session.cpp')
| -rw-r--r-- | src/catch2/catch_session.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index 5e9c5c19..bf14d23b 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -140,9 +140,7 @@ namespace Catch { }; void applyFilenamesAsTags() { - for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) { - testInfo->addFilenameTag(); - } + getMutableRegistryHub().getMutableTestCaseRegistry().enableFilenameTags(); } // Creates empty file at path. The path must be writable, we do not |