aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZufu Liu <unknown>2023-10-19 08:07:31 +1100
committerZufu Liu <unknown>2023-10-19 08:07:31 +1100
commitfdbb5c9273a8f25f86f4113b837926f883083b23 (patch)
treec97560988cbba80c50223d788cef0c3897c22764
parent6ecf3b0fe2e8a157cd1ceaa72c28c750ccc25d8c (diff)
downloadscintilla-mirror-fdbb5c9273a8f25f86f4113b837926f883083b23.tar.gz
Fix regex test failures on Unix by setting global locale.
-rw-r--r--test/unit/testDocument.cxx12
1 files changed, 12 insertions, 0 deletions
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 {