tests: check setlocale return value
It might fail while nl_langinfo does not.
This commit is contained in:
@ -64,15 +64,12 @@ bool
|
|||||||
Mu::set_en_us_utf8_locale()
|
Mu::set_en_us_utf8_locale()
|
||||||
{
|
{
|
||||||
setenv("LC_ALL", "en_US.UTF-8", 1);
|
setenv("LC_ALL", "en_US.UTF-8", 1);
|
||||||
setlocale(LC_ALL, "en_US.UTF-8");
|
|
||||||
|
|
||||||
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) {
|
if (auto str = setlocale(LC_ALL, "en_US.UTF-8"); !str)
|
||||||
/* LCOV_EXCL_START*/
|
return false;
|
||||||
mu_println("Note: Unit tests require the en_US.utf8 locale. "
|
|
||||||
"Ignoring test cases.");
|
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
|
||||||
/* LCOV_EXCL_STOP*/
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user