localspl/tests: Improve the tests in test_XcvDataPort_AddPort by properly checking return values and avoiding a duplicate test. (try 2)

Gerald Pfeifer gerald at pfeifer.com
Sun May 2 18:44:09 CDT 2010


---
 dlls/localspl/tests/localmon.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index 23a3608..413a95a 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -777,7 +777,6 @@ static void test_XcvDataPort_AddPort(void)
 {
     DWORD   res;
 
-
     /*
      * The following tests crash with native localspl.dll on w2k and xp,
      * but it works, when the native dll (w2k and xp) is used in wine.
@@ -791,18 +790,17 @@ static void test_XcvDataPort_AddPort(void)
     /* create a Port for a normal, writable file */
     SetLastError(0xdeadbeef);
     res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
+    ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError());
 
     /* add our testport again */
     SetLastError(0xdeadbeef);
     res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
+    ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
 
     /* create a well-known Port  */
     SetLastError(0xdeadbeef);
     res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL);
-
-    SetLastError(0xdeadbeef);
-    res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL);
-    /* native localspl.dll on wine: ERROR_ALREADY_EXISTS */
+    ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
 
     /* ERROR_ALREADY_EXISTS is also returned from native localspl.dll on wine,
        when "RPT1:" was already installed for redmonnt.dll:
@@ -812,6 +810,7 @@ static void test_XcvDataPort_AddPort(void)
     /* cleanup */
     SetLastError(0xdeadbeef);
     res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL);
+    ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError());
     }
 
 }
-- 
1.6.6.2



More information about the wine-patches mailing list