mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Fix cppformat failures on MacOS tests.
cppformat tests failed on MacOS - the global locale was not set and defaulted to something unexcpeted. It is now fixed to US notation. Patch By: Krinkle Reviewed By: wraitii Differential Revision: https://code.wildfiregames.com/D1978 This was SVN commit r22378.
This commit is contained in:
@@ -113,8 +113,7 @@ public:
|
|||||||
// because GTK+ can change the locale when we're running Atlas.
|
// 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
|
// (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)
|
// then it'll just stick with the default, which is fine)
|
||||||
char* old = setlocale(LC_NUMERIC, NULL);
|
char* old = setlocale(LC_NUMERIC, "fr_FR.UTF-8");
|
||||||
setlocale(LC_NUMERIC, "fr_FR.UTF-8");
|
|
||||||
|
|
||||||
CStr8 str1("1.234");
|
CStr8 str1("1.234");
|
||||||
TS_ASSERT_DELTA(str1.ToFloat(), 1.234f, 0.0001f);
|
TS_ASSERT_DELTA(str1.ToFloat(), 1.234f, 0.0001f);
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class TestCppformat : public CxxTest::TestSuite
|
|||||||
public:
|
public:
|
||||||
void test_basic()
|
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("abc"), "abc");
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(fmt::sprintf("%d", 123), "123");
|
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%sT", (const char*)NULL), "T(null)T");
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(fmt::sprintf("T%pT", (void*)0x1234), "T0x1234T");
|
TS_ASSERT_EQUALS(fmt::sprintf("T%pT", (void*)0x1234), "T0x1234T");
|
||||||
|
|
||||||
|
setlocale(LC_ALL, old);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user