Zhiyi Zhang (@zhiyi) commented about dlls/bcp47langs/tests/bcp47langs.c:
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#include <winbase.h>
+#include "winstring.h" +#include "msvcrt/locale.h" +#include "bcp47langs.h"
+#include "wine/test.h"
+static void test_GetUserLanguages(void) +{
- HSTRING result;
- const WCHAR *user_languages;
Let's use a loop and static test data to test it. For example ``` static const struct { const char *locale; const WCHAR *expected_languages; } tests[] = { {"enu", L"en-US"}, ... add usual locales, for example, English, Chinese, Japanese, Korean, Arabic, French, German. }
for (int i =0; i < ARRAY_SIZE(tests); i++) { winetest_push_context("%d", i); setlocale(LC_ALL, tests[i].locale); ok(GetUserLanguages(',', &result) == 0, "unknown return code\n"); user_languages = WindowsGetStringRawBuffer(result, NULL); ok(!lstrcmpW(user_languages, tests[i].expected_languages), "languages=%s\n", debugstr_w(user_languages)); winetest_pop_context(); } ```
And remember to restore the original locale when the test ends.