Andrew Nguyen : kernel32/tests: Centralize the FormatMessageW skip detection.

Alexandre Julliard julliard at winehq.org
Wed Apr 28 16:35:47 CDT 2010


Module: wine
Branch: master
Commit: e724f6aa28be9590f61749f017350975253a4790
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e724f6aa28be9590f61749f017350975253a4790

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Wed Apr 28 04:20:39 2010 -0500

kernel32/tests: Centralize the FormatMessageW skip detection.

---

 dlls/kernel32/tests/format_msg.c |   71 ++++++++-----------------------------
 1 files changed, 16 insertions(+), 55 deletions(-)

diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c
index 1bf1188..24dfd3b 100644
--- a/dlls/kernel32/tests/format_msg.c
+++ b/dlls/kernel32/tests/format_msg.c
@@ -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);
@@ -902,14 +885,6 @@ static void test_message_insufficient_buffer_wide(void)
     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);
     ok(ret == 0, "Expected FormatMessageA to return 0, got %u\n", ret);
@@ -1006,15 +981,6 @@ static void test_message_null_buffer_wide(void)
     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();
     ok(!ret, "FormatMessageW returned %u\n", ret);
     ok(error == ERROR_INVALID_PARAMETER, "last error %u\n", error);
 
@@ -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
@@ -1397,14 +1355,6 @@ static void test_message_invalid_flags_wide(void)
     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);
     ok(ret == 0, "Expected FormatMessageW to return 0, got %u\n", ret);
@@ -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();
 }




More information about the wine-cvs mailing list