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

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLeitwolf112026-11-16 12:36:27 +0300
committerLeitwolf112026-11-16 12:36:27 +0300
commit0cc73f2c53f40a172dd5bbfee0c96d25599d9dba (patch)
treedbc5259b0540b11ae9ee996fc14c13857580c913
parenta6c83f1bfaf42c9ea16639c749dd587243e86e9c (diff)
downloadcatch3-0cc73f2c53f40a172dd5bbfee0c96d25599d9dba.tar.gz
Measure the table strings with std::string and regenerate the amalgamation
The self tests are also built as C++14 (Meson with Clang-CL), where std::string_view does not exist. The amalgamated source carries the change to Process.cpp. Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
-rw-r--r--extras/catch_amalgamated.cpp7
-rw-r--r--tests/SelfTest/UsageTests/Generators.tests.cpp4
2 files changed, 8 insertions, 3 deletions
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index a5dc580c..475c5ea8 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -16957,7 +16957,12 @@ namespace Progmasoft::Catch3::Runner
std::string buffer(size, '\0');
if (_NSGetExecutablePath(buffer.data(), &size) == 0)
{
- buffer.resize(std::strlen(buffer.c_str()));
+ // The path ends at its first NUL, never past the buffer.
+ const auto end = buffer.find('\0');
+ if (end != std::string::npos)
+ {
+ buffer.resize(end);
+ }
auto canonical = std::filesystem::weakly_canonical(buffer, error);
return error ? std::filesystem::path{ buffer } : canonical;
}
diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp
index 77ffde8d..41138b5a 100644
--- a/tests/SelfTest/UsageTests/Generators.tests.cpp
+++ b/tests/SelfTest/UsageTests/Generators.tests.cpp
@@ -12,7 +12,7 @@
#include <Progmasoft/Catch3/Generators/Random.hpp>
#include <Progmasoft/Catch3/Generators/Range.hpp>
-#include <string_view>
+#include <string>
// Generators and sections can be nested freely
@@ -62,7 +62,7 @@ TEST_CASE("tables", "[generators]") {
tuple_type{"etc...", 6}
}));
- REQUIRE(std::string_view(std::get<0>(data)).size() == static_cast<size_t>(std::get<1>(data)));
+ REQUIRE(std::string(std::get<0>(data)).size() == static_cast<size_t>(std::get<1>(data)));
}