Commit ee518b5e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32/tests: Don't test last error when there's no failure.

parent 7066ce0b
...@@ -546,32 +546,22 @@ static void test_threadcp(void) ...@@ -546,32 +546,22 @@ static void test_threadcp(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
memset(&cpi, 0, sizeof(cpi)); memset(&cpi, 0, sizeof(cpi));
ret = GetCPInfoExA(CP_ACP, 0, &cpi); ret = GetCPInfoExA(CP_ACP, 0, &cpi);
ok(ret, "GetCPInfoExA failed for lcid %04x\n", lcids[i].lcid); ok(ret, "GetCPInfoExA failed for lcid %04x, error %d\n", lcids[i].lcid, GetLastError());
ok(GetLastError() == 0xdeadbeef ||
broken(GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND), /* win2k */
"GetLastError() is %u for lcid %04x\n", GetLastError(), lcids[i].lcid);
ok(cpi.CodePage == acp, "wrong codepage %u for lcid %04x, should be %u\n", cpi.CodePage, lcids[i].lcid, acp); ok(cpi.CodePage == acp, "wrong codepage %u for lcid %04x, should be %u\n", cpi.CodePage, lcids[i].lcid, acp);
/* WideCharToMultiByte - CP_ACP */ /* WideCharToMultiByte - CP_ACP */
SetLastError(0xdeadbeef);
num = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL); num = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL);
ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid);
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u (%04x)\n", GetLastError(), lcids[i].lcid);
/* MultiByteToWideChar - CP_ACP */ /* MultiByteToWideChar - CP_ACP */
SetLastError(0xdeadbeef);
num = MultiByteToWideChar(CP_ACP, 0, "foobar", -1, NULL, 0); num = MultiByteToWideChar(CP_ACP, 0, "foobar", -1, NULL, 0);
ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid);
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u (%04x)\n", GetLastError(), lcids[i].lcid);
/* GetCPInfoEx/GetCPInfo - CP_THREAD_ACP */ /* GetCPInfoEx/GetCPInfo - CP_THREAD_ACP */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
memset(&cpi, 0, sizeof(cpi)); memset(&cpi, 0, sizeof(cpi));
ret = GetCPInfoExA(CP_THREAD_ACP, 0, &cpi); ret = GetCPInfoExA(CP_THREAD_ACP, 0, &cpi);
ok(ret, "GetCPInfoExA failed for lcid %04x\n", lcids[i].lcid); ok(ret, "GetCPInfoExA failed for lcid %04x, error %d\n", lcids[i].lcid, GetLastError());
ok(GetLastError() == 0xdeadbeef ||
broken(GetLastError() == ERROR_RESOURCE_LANG_NOT_FOUND), /* win2k */
"GetLastError() is %u for lcid %04x\n", GetLastError(), lcids[i].lcid);
if (lcids[i].threadcp) if (lcids[i].threadcp)
ok(cpi.CodePage == lcids[i].threadcp, "wrong codepage %u for lcid %04x, should be %u\n", ok(cpi.CodePage == lcids[i].threadcp, "wrong codepage %u for lcid %04x, should be %u\n",
cpi.CodePage, lcids[i].lcid, lcids[i].threadcp); cpi.CodePage, lcids[i].lcid, lcids[i].threadcp);
...@@ -580,16 +570,12 @@ static void test_threadcp(void) ...@@ -580,16 +570,12 @@ static void test_threadcp(void)
cpi.CodePage, lcids[i].lcid, acp); cpi.CodePage, lcids[i].lcid, acp);
/* WideCharToMultiByte - CP_THREAD_ACP */ /* WideCharToMultiByte - CP_THREAD_ACP */
SetLastError(0xdeadbeef);
num = WideCharToMultiByte(CP_THREAD_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL); num = WideCharToMultiByte(CP_THREAD_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL);
ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid);
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u (%04x)\n", GetLastError(), lcids[i].lcid);
/* MultiByteToWideChar - CP_THREAD_ACP */ /* MultiByteToWideChar - CP_THREAD_ACP */
SetLastError(0xdeadbeef);
num = MultiByteToWideChar(CP_THREAD_ACP, 0, "foobar", -1, NULL, 0); num = MultiByteToWideChar(CP_THREAD_ACP, 0, "foobar", -1, NULL, 0);
ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid); ok(num == 7, "ret is %d (%04x)\n", num, lcids[i].lcid);
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u (%04x)\n", GetLastError(), lcids[i].lcid);
} }
/* IsDBCSLeadByteEx - locales without codepage */ /* IsDBCSLeadByteEx - locales without codepage */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment