From fdbb5c9273a8f25f86f4113b837926f883083b23 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Thu, 19 Oct 2023 08:07:31 +1100 Subject: Fix regex test failures on Unix by setting global locale. --- test/unit/testDocument.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/testDocument.cxx b/test/unit/testDocument.cxx index 4ed1dbbbd..570e54c4c 100644 --- a/test/unit/testDocument.cxx +++ b/test/unit/testDocument.cxx @@ -38,6 +38,18 @@ using namespace Scintilla; using namespace Scintilla::Internal; +#if !defined(_WIN32) && !defined(NO_CXX11_REGEX) +// set global locale to pass std::regex related tests +// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63776 +struct GlobalLocaleInitializer { + GlobalLocaleInitializer() { + try { + std::locale::global(std::locale("en_US.UTF-8")); + } catch (...) {} + } +} globalLocaleInitializer; +#endif + // Test Document. struct Folding { -- cgit v1.2.3