kernel32/tests: Centralize the FormatMessageW skip detection.

This commit is contained in:
Andrew Nguyen 2010-04-28 04:20:39 -05:00 committed by Alexandre Julliard
parent 5505ae978b
commit e724f6aa28
1 changed files with 16 additions and 55 deletions

View File

@ -130,15 +130,6 @@ static void test_message_from_string_wide(void)
WCHAR out[0x100] = {0};
DWORD r, error;
SetLastError(0xdeadbeef);
r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
error = GetLastError();
if (!r && error == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
/* the basics */
r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, test, 0,
0, out, sizeof(out)/sizeof(WCHAR), NULL);
@ -802,14 +793,6 @@ static void test_message_ignore_inserts_wide(void)
DWORD ret;
WCHAR out[256];
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, test, 0, 0, out,
sizeof(out)/sizeof(WCHAR), NULL);
ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret);
@ -901,14 +884,6 @@ static void test_message_insufficient_buffer_wide(void)
DWORD ret;
WCHAR out[5];
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
SetLastError(0xdeadbeef);
memcpy(out, init_buf, sizeof(init_buf));
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, test, 0, 0, out, 0, NULL);
@ -1003,15 +978,6 @@ static void test_message_null_buffer_wide(void)
{
DWORD ret, error;
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 0, NULL);
error = GetLastError();
if (!ret && error == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 0, NULL);
error = GetLastError();
@ -1144,14 +1110,6 @@ static void test_message_allocate_buffer_wide(void)
DWORD ret;
WCHAR *buf;
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
/* While MSDN suggests that FormatMessageW allocates a buffer whose size is
* the larger of the output string and the requested buffer size, the tests
* will not try to determine the actual size of the buffer allocated, as
@ -1396,14 +1354,6 @@ static void test_message_invalid_flags_wide(void)
WCHAR out[5];
WCHAR *ptr;
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
SetLastError(0xdeadbeef);
memcpy(out, init_buf, sizeof(init_buf));
ret = FormatMessageW(0, test, 0, 0, out, sizeof(out)/sizeof(WCHAR), NULL);
@ -1482,17 +1432,28 @@ static void test_message_invalid_flags_wide(void)
START_TEST(format_msg)
{
DWORD ret;
test_message_from_string();
test_message_from_string_wide();
test_message_ignore_inserts();
test_message_ignore_inserts_wide();
test_message_insufficient_buffer();
test_message_insufficient_buffer_wide();
test_message_null_buffer();
test_message_null_buffer_wide();
test_message_allocate_buffer();
test_message_allocate_buffer_wide();
test_message_from_hmodule();
test_message_invalid_flags();
SetLastError(0xdeadbeef);
ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("FormatMessageW is not implemented\n");
return;
}
test_message_from_string_wide();
test_message_ignore_inserts_wide();
test_message_insufficient_buffer_wide();
test_message_null_buffer_wide();
test_message_allocate_buffer_wide();
test_message_invalid_flags_wide();
}