From a6bf1a5ffb112db7d165508226fb9f029fa94d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Zwing?= Date: Tue, 28 Dec 2021 20:09:48 +0100 Subject: [PATCH] kernel32/tests: Don't test functions directly when reporting GetLastError(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Zwing Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/locale.c | 68 +++++++++++++++--------------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index d64a08666f8..2d327b7130c 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -7048,22 +7048,19 @@ static BOOL CALLBACK calinfo_procA(LPSTR calinfo) static void test_EnumCalendarInfoA(void) { + BOOL ret; INT i; - ok( EnumCalendarInfoA( calinfo_procA, - LOCALE_USER_DEFAULT, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ), - "EnumCalendarInfoA for user default locale failed: %u\n", GetLastError() ); + ret = EnumCalendarInfoA( calinfo_procA, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret, "EnumCalendarInfoA for user default locale failed: %u\n", GetLastError() ); for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++) { LCID lcid = locales_with_optional_calendars[i]; - ok( EnumCalendarInfoA( calinfo_procA, - lcid, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) || - broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, + ret = EnumCalendarInfoA( calinfo_procA, lcid, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, "EnumCalendarInfoA for LCID %#06x failed: %u\n", lcid, GetLastError() ); } } @@ -7076,22 +7073,19 @@ static BOOL CALLBACK calinfo_procW(LPWSTR calinfo) static void test_EnumCalendarInfoW(void) { + BOOL ret; INT i; - ok( EnumCalendarInfoW( calinfo_procW, - LOCALE_USER_DEFAULT, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ), - "EnumCalendarInfoW for user default locale failed: %u\n", GetLastError() ); + ret = EnumCalendarInfoW( calinfo_procW, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret, "EnumCalendarInfoW for user default locale failed: %u\n", GetLastError() ); for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++) { LCID lcid = locales_with_optional_calendars[i]; - ok( EnumCalendarInfoW( calinfo_procW, - lcid, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) || - broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, + ret = EnumCalendarInfoW( calinfo_procW, lcid, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, "EnumCalendarInfoW for LCID %#06x failed: %u\n", lcid, GetLastError() ); } } @@ -7105,22 +7099,19 @@ static BOOL CALLBACK calinfoex_procA(LPSTR calinfo, LCID calid) static void test_EnumCalendarInfoExA(void) { + BOOL ret; INT i; - ok( EnumCalendarInfoExA( calinfoex_procA, - LOCALE_USER_DEFAULT, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ), - "EnumCalendarInfoExA for user default locale failed: %u\n", GetLastError() ); + ret = EnumCalendarInfoExA( calinfoex_procA, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret, "EnumCalendarInfoExA for user default locale failed: %u\n", GetLastError() ); for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++) { LCID lcid = locales_with_optional_calendars[i]; - ok( EnumCalendarInfoExA( calinfoex_procA, - lcid, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) || - broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, + ret = EnumCalendarInfoExA( calinfoex_procA, lcid, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, "EnumCalendarInfoExA for LCID %#06x failed: %u\n", lcid, GetLastError() ); } } @@ -7134,22 +7125,19 @@ static BOOL CALLBACK calinfoex_procW(LPWSTR calinfo, LCID calid) static void test_EnumCalendarInfoExW(void) { + BOOL ret; INT i; - ok( EnumCalendarInfoExW( calinfoex_procW, - LOCALE_USER_DEFAULT, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ), - "EnumCalendarInfoExW for user default locale failed: %u\n", GetLastError() ); + ret = EnumCalendarInfoExW( calinfoex_procW, LOCALE_USER_DEFAULT, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret, "EnumCalendarInfoExW for user default locale failed: %u\n", GetLastError() ); for (i = 0; i < ARRAY_SIZE( locales_with_optional_calendars ); i++) { LCID lcid = locales_with_optional_calendars[i]; - ok( EnumCalendarInfoExW( calinfoex_procW, - lcid, - ENUM_ALL_CALENDARS, - CAL_RETURN_NUMBER | CAL_ICALINTVALUE ) || - broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, + ret = EnumCalendarInfoExW( calinfoex_procW, lcid, ENUM_ALL_CALENDARS, + CAL_RETURN_NUMBER | CAL_ICALINTVALUE ); + ok( ret || broken( GetLastError() == ERROR_INVALID_FLAGS ) /* no locale */, "EnumCalendarInfoExW for LCID %#06x failed: %u\n", lcid, GetLastError() ); } }