From 3bb92d777385e229ed813397e2c7b57f7f5415bc Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Mon, 16 Dec 2019 22:39:39 +0900 Subject: [PATCH] kernel32/tests: Refactor MB_ERR_INVALID_CHARS tests. Signed-off-by: Akihiro Sagawa Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/codepage.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 8fcc575a29e..dc25c556526 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -1001,7 +1001,7 @@ static void test_utf7_decoding(void) static void test_undefined_byte_char(void) { static const struct tag_testset { - INT codepage; + UINT codepage; LPCSTR str; BOOL is_error; } testset[] = { @@ -1017,6 +1017,7 @@ static void test_undefined_byte_char(void) { 1257, "\xa5", TRUE }, }; INT i, ret; + DWORD err; for (i = 0; i < ARRAY_SIZE(testset); i++) { if (! IsValidCodePage(testset[i].codepage)) @@ -1028,23 +1029,22 @@ static void test_undefined_byte_char(void) SetLastError(0xdeadbeef); ret = MultiByteToWideChar(testset[i].codepage, MB_ERR_INVALID_CHARS, testset[i].str, -1, NULL, 0); + err = GetLastError(); if (testset[i].is_error) { - ok(ret == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION, - "ret is %d, GetLastError is %u (cp %d)\n", - ret, GetLastError(), testset[i].codepage); + ok(err == ERROR_NO_UNICODE_TRANSLATION, "Test %u: err is %u\n", i, err); + ok(ret == 0, "Test %u: ret is %d\n", i, ret); } else { - ok(ret == strlen(testset[i].str)+1 && GetLastError() == 0xdeadbeef, - "ret is %d, GetLastError is %u (cp %d)\n", - ret, GetLastError(), testset[i].codepage); + ok(err == 0xdeadbeef, "Test %u: err is %u\n", i, err); + ok(ret == 2, "Test %u: ret is %d\n", i, ret); } SetLastError(0xdeadbeef); ret = MultiByteToWideChar(testset[i].codepage, 0, testset[i].str, -1, NULL, 0); - ok(ret == strlen(testset[i].str)+1 && GetLastError() == 0xdeadbeef, - "ret is %d, GetLastError is %u (cp %d)\n", - ret, GetLastError(), testset[i].codepage); + err = GetLastError(); + ok(err == 0xdeadbeef, "Test %u: err is %u\n", i, err); + ok(ret == 2, "Test %u: ret is %d\n", i, ret); } }