Paul Vriens : wininet/tests: Add a few more tests.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 7 16:00:18 CST 2007


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

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Wed Feb  7 15:54:30 2007 +0100

wininet/tests: Add a few more tests.

---

 dlls/wininet/tests/ftp.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index df36db7..3a5fa70 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -253,6 +253,11 @@ static void test_getfile(void)
         return;
     }
 
+    /* Make sure we start clean */
+
+    DeleteFileA("should_be_non_existing_deadbeef");
+    DeleteFileA("should_also_be_non_existing_deadbeef");
+
     /* We should have a ftp-connection, try some getting */
 
     /* No remote file */
@@ -260,8 +265,14 @@ static void test_getfile(void)
     bRet = FtpGetFileA(hFtp, NULL, "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     todo_wine
+    {
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
         "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+    /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
+    ok (GetFileAttributesA("should_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
+        "Local file should not have been created\n");
+    }
+    DeleteFileA("should_be_non_existing_deadbeef");
 
     /* No local file */
     SetLastError(0xdeadbeef);
@@ -280,6 +291,9 @@ static void test_getfile(void)
     ok ( GetLastError() == ERROR_SUCCESS,
         "Expected ERROR_SUCCESS, got %d\n", GetLastError());
     }
+    /* Wine passes this test but for the wrong reason */
+    ok (GetFileAttributesA("should_be_non_existing_deadbeef") != INVALID_FILE_ATTRIBUTES,
+        "Local file should have been created\n");
     DeleteFileA("should_be_non_existing_deadbeef");
 
     /* Illegal condition flags */
@@ -287,20 +301,25 @@ static void test_getfile(void)
     bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, 5, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     todo_wine
+    {
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
         "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+    ok (GetFileAttributesA("should_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
+        "Local file should not have been created\n");
+    }
+    DeleteFileA("should_be_non_existing_deadbeef");
 
     /* Remote file doesn't exist */
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     todo_wine
+    {
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
-    /* Wine currently creates the file (empty though), cater for that */
-    todo_wine
     ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
+    }
     DeleteFileA("should_also_be_non_existing_deadbeef");
 
     /* This one should succeed and give us a copy of the 'welcome.msg' file */




More information about the wine-cvs mailing list