diff --git a/source/ps/tests/test_CStr.h b/source/ps/tests/test_CStr.h index 317f8e62f4..4e7562ec20 100644 --- a/source/ps/tests/test_CStr.h +++ b/source/ps/tests/test_CStr.h @@ -113,8 +113,7 @@ public: // because GTK+ can change the locale when we're running Atlas. // (If the host system doesn't have the locale we're using for this test // then it'll just stick with the default, which is fine) - char* old = setlocale(LC_NUMERIC, NULL); - setlocale(LC_NUMERIC, "fr_FR.UTF-8"); + char* old = setlocale(LC_NUMERIC, "fr_FR.UTF-8"); CStr8 str1("1.234"); TS_ASSERT_DELTA(str1.ToFloat(), 1.234f, 0.0001f); diff --git a/source/ps/tests/test_cppformat.h b/source/ps/tests/test_cppformat.h index 02d0193694..df2e2f8380 100644 --- a/source/ps/tests/test_cppformat.h +++ b/source/ps/tests/test_cppformat.h @@ -24,6 +24,9 @@ class TestCppformat : public CxxTest::TestSuite public: void test_basic() { + // Make test behave independent of current host locale + char* old = setlocale(LC_ALL, "en_US.UTF-8"); + TS_ASSERT_EQUALS(fmt::sprintf("abc"), "abc"); TS_ASSERT_EQUALS(fmt::sprintf("%d", 123), "123"); @@ -54,5 +57,7 @@ public: TS_ASSERT_EQUALS(fmt::sprintf("T%sT", (const char*)NULL), "T(null)T"); TS_ASSERT_EQUALS(fmt::sprintf("T%pT", (void*)0x1234), "T0x1234T"); + + setlocale(LC_ALL, old); } };