doctest: Update to 2.4.12

This commit is contained in:
Rémi Verschelde 2025-06-05 17:35:23 +02:00
parent d59994688c
commit d14283df94
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 40 additions and 13 deletions

View file

@ -187,7 +187,7 @@ Patches:
## doctest ## doctest
- Upstream: https://github.com/onqtam/doctest - Upstream: https://github.com/onqtam/doctest
- Version: 2.4.11 (ae7a13539fb71f270b87eb2e874fbac80bc8dda2, 2023) - Version: 2.4.12 (1da23a3e8119ec5cce4f9388e91b065e20bf06f5, 2025)
- License: MIT - License: MIT
Files extracted from upstream source: Files extracted from upstream source:
@ -195,6 +195,10 @@ Files extracted from upstream source:
- `doctest/doctest.h` as `doctest.h` - `doctest/doctest.h` as `doctest.h`
- `LICENSE.txt` - `LICENSE.txt`
Patches:
- `0001-ciso646-version.patch` (GH-105913)
## embree ## embree

View file

@ -48,7 +48,7 @@
#define DOCTEST_VERSION_MAJOR 2 #define DOCTEST_VERSION_MAJOR 2
#define DOCTEST_VERSION_MINOR 4 #define DOCTEST_VERSION_MINOR 4
#define DOCTEST_VERSION_PATCH 11 #define DOCTEST_VERSION_PATCH 12
// util we need here // util we need here
#define DOCTEST_TOSTR_IMPL(x) #x #define DOCTEST_TOSTR_IMPL(x) #x
@ -490,7 +490,6 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
#endif #endif
#endif // DOCTEST_CONFIG_USE_IOSFWD #endif // DOCTEST_CONFIG_USE_IOSFWD
// BEGIN TEMPORARY PATCH (comes from https://github.com/doctest/doctest/pull/901)
// for clang - always include <version> or <ciso646> (which drags some std stuff) // for clang - always include <version> or <ciso646> (which drags some std stuff)
// because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in // because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
// which case we don't want to forward declare stuff from std - for reference: // which case we don't want to forward declare stuff from std - for reference:
@ -503,7 +502,6 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
#include <ciso646> #include <ciso646>
#endif #endif
#endif // clang #endif // clang
// END TEMPORARY PATCH
#ifdef _LIBCPP_VERSION #ifdef _LIBCPP_VERSION
#ifndef DOCTEST_CONFIG_USE_STD_HEADERS #ifndef DOCTEST_CONFIG_USE_STD_HEADERS
@ -931,6 +929,7 @@ struct ContextOptions //!OCLINT too many fields
bool no_skip; // don't skip test cases which are marked to be skipped bool no_skip; // don't skip test cases which are marked to be skipped
bool gnu_file_line; // if line numbers should be surrounded with :x: and not (x): bool gnu_file_line; // if line numbers should be surrounded with :x: and not (x):
bool no_path_in_filenames; // if the path to files should be removed from the output bool no_path_in_filenames; // if the path to files should be removed from the output
String strip_file_prefixes;// remove the longest matching one of these prefixes from any file paths in the output
bool no_line_numbers; // if source code line numbers should be omitted from the output bool no_line_numbers; // if source code line numbers should be omitted from the output
bool no_debug_output; // no output in the debug console when a debugger is attached bool no_debug_output; // no output in the debug console when a debugger is attached
bool no_skipped_summary; // don't print "skipped" in the summary !!! UNDOCUMENTED !!! bool no_skipped_summary; // don't print "skipped" in the summary !!! UNDOCUMENTED !!!
@ -1584,8 +1583,8 @@ DOCTEST_CLANG_SUPPRESS_WARNING_POP
// https://github.com/catchorg/Catch2/issues/870 // https://github.com/catchorg/Catch2/issues/870
// https://github.com/catchorg/Catch2/issues/565 // https://github.com/catchorg/Catch2/issues/565
template <typename L> template <typename L>
Expression_lhs<L> operator<<(L&& operand) { Expression_lhs<const L&&> operator<<(const L&& operand) { //bitfields bind to universal ref but not const rvalue ref
return Expression_lhs<L>(static_cast<L&&>(operand), m_at); return Expression_lhs<const L&&>(static_cast<const L&&>(operand), m_at);
} }
template <typename L,typename types::enable_if<!doctest::detail::types::is_rvalue_reference<L>::value,void >::type* = nullptr> template <typename L,typename types::enable_if<!doctest::detail::types::is_rvalue_reference<L>::value,void >::type* = nullptr>
@ -3249,6 +3248,10 @@ DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
#define DOCTEST_CONFIG_OPTIONS_PREFIX "dt-" #define DOCTEST_CONFIG_OPTIONS_PREFIX "dt-"
#endif #endif
#ifndef DOCTEST_CONFIG_OPTIONS_FILE_PREFIX_SEPARATOR
#define DOCTEST_CONFIG_OPTIONS_FILE_PREFIX_SEPARATOR ':'
#endif
#ifndef DOCTEST_THREAD_LOCAL #ifndef DOCTEST_THREAD_LOCAL
#if defined(DOCTEST_CONFIG_NO_MULTITHREADING) || DOCTEST_MSVC && (DOCTEST_MSVC < DOCTEST_COMPILER(19, 0, 0)) #if defined(DOCTEST_CONFIG_NO_MULTITHREADING) || DOCTEST_MSVC && (DOCTEST_MSVC < DOCTEST_COMPILER(19, 0, 0))
#define DOCTEST_THREAD_LOCAL #define DOCTEST_THREAD_LOCAL
@ -3757,7 +3760,7 @@ String::size_type String::capacity() const {
} }
String String::substr(size_type pos, size_type cnt) && { String String::substr(size_type pos, size_type cnt) && {
cnt = std::min(cnt, size() - 1 - pos); cnt = std::min(cnt, size() - pos);
char* cptr = c_str(); char* cptr = c_str();
memmove(cptr, cptr + pos, cnt); memmove(cptr, cptr + pos, cnt);
setSize(cnt); setSize(cnt);
@ -3765,7 +3768,7 @@ String String::substr(size_type pos, size_type cnt) && {
} }
String String::substr(size_type pos, size_type cnt) const & { String String::substr(size_type pos, size_type cnt) const & {
cnt = std::min(cnt, size() - 1 - pos); cnt = std::min(cnt, size() - pos);
return String{ c_str() + pos, cnt }; return String{ c_str() + pos, cnt };
} }
@ -3897,6 +3900,26 @@ const char* skipPathFromFilename(const char* file) {
forward = back; forward = back;
return forward + 1; return forward + 1;
} }
} else {
const auto prefixes = getContextOptions()->strip_file_prefixes;
const char separator = DOCTEST_CONFIG_OPTIONS_FILE_PREFIX_SEPARATOR;
String::size_type longest_match = 0U;
for(String::size_type pos = 0U; pos < prefixes.size(); ++pos)
{
const auto prefix_start = pos;
pos = std::min(prefixes.find(separator, prefix_start), prefixes.size());
const auto prefix_size = pos - prefix_start;
if(prefix_size > longest_match)
{
// TODO under DOCTEST_MSVC: does the comparison need strnicmp() to work with drive letter capitalization?
if(0 == std::strncmp(prefixes.c_str() + prefix_start, file, prefix_size))
{
longest_match = prefix_size;
}
}
}
return &file[longest_match];
} }
#endif // DOCTEST_CONFIG_DISABLE #endif // DOCTEST_CONFIG_DISABLE
return file; return file;
@ -6187,6 +6210,8 @@ namespace {
<< Whitespace(sizePrefixDisplay*1) << ":n: vs (n): for line numbers in output\n"; << Whitespace(sizePrefixDisplay*1) << ":n: vs (n): for line numbers in output\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "npf, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-path-filenames=<bool> " s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "npf, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-path-filenames=<bool> "
<< Whitespace(sizePrefixDisplay*1) << "only filenames and no paths in output\n"; << Whitespace(sizePrefixDisplay*1) << "only filenames and no paths in output\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "spp, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "skip-path-prefixes=<p1:p2> "
<< Whitespace(sizePrefixDisplay*1) << "whenever file paths start with this prefix, remove it from the output\n";
s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nln, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-line-numbers=<bool> " s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nln, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-line-numbers=<bool> "
<< Whitespace(sizePrefixDisplay*1) << "0 instead of real line numbers in output\n"; << Whitespace(sizePrefixDisplay*1) << "0 instead of real line numbers in output\n";
// ================================================================================== << 79 // ================================================================================== << 79
@ -6691,6 +6716,7 @@ void Context::parseArgs(int argc, const char* const* argv, bool withDefaults) {
DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skip", "ns", no_skip, false); DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skip", "ns", no_skip, false);
DOCTEST_PARSE_AS_BOOL_OR_FLAG("gnu-file-line", "gfl", gnu_file_line, !bool(DOCTEST_MSVC)); DOCTEST_PARSE_AS_BOOL_OR_FLAG("gnu-file-line", "gfl", gnu_file_line, !bool(DOCTEST_MSVC));
DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-path-filenames", "npf", no_path_in_filenames, false); DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-path-filenames", "npf", no_path_in_filenames, false);
DOCTEST_PARSE_STR_OPTION("strip-file-prefixes", "sfp", strip_file_prefixes, "");
DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-line-numbers", "nln", no_line_numbers, false); DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-line-numbers", "nln", no_line_numbers, false);
DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-debug-output", "ndo", no_debug_output, false); DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-debug-output", "ndo", no_debug_output, false);
DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skipped-summary", "nss", no_skipped_summary, false); DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skipped-summary", "nss", no_skipped_summary, false);

View file

@ -1,14 +1,13 @@
diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h
index 5c754cde08a..482749ccb2b 100644 index 52b4a4aa30..4a1e4a09d7 100644
--- a/thirdparty/doctest/doctest.h --- a/thirdparty/doctest/doctest.h
+++ b/thirdparty/doctest/doctest.h +++ b/thirdparty/doctest/doctest.h
@@ -490,14 +490,20 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP @@ -490,13 +490,17 @@ DOCTEST_GCC_SUPPRESS_WARNING_POP
#endif #endif
#endif // DOCTEST_CONFIG_USE_IOSFWD #endif // DOCTEST_CONFIG_USE_IOSFWD
-// for clang - always include ciso646 (which drags some std stuff) because -// for clang - always include ciso646 (which drags some std stuff) because
-// we want to check if we are using libc++ with the _LIBCPP_VERSION macro in -// we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
+// BEGIN TEMPORARY PATCH (comes from https://github.com/doctest/doctest/pull/901)
+// for clang - always include <version> or <ciso646> (which drags some std stuff) +// for clang - always include <version> or <ciso646> (which drags some std stuff)
+// because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in +// because we want to check if we are using libc++ with the _LIBCPP_VERSION macro in
// which case we don't want to forward declare stuff from std - for reference: // which case we don't want to forward declare stuff from std - for reference:
@ -21,7 +20,5 @@ index 5c754cde08a..482749ccb2b 100644
#include <ciso646> #include <ciso646>
+#endif +#endif
#endif // clang #endif // clang
+// END TEMPORARY PATCH
#ifdef _LIBCPP_VERSION #ifdef _LIBCPP_VERSION
#ifndef DOCTEST_CONFIG_USE_STD_HEADERS