[PATCH 5/5] lz32/tests: Test creation of a file when it already
exists.
Saulius Krasuckas
saulius.krasuckas at ieee.org
Thu Oct 5 12:52:49 CDT 2006
---
dlls/lz32/tests/lzexpand_main.c | 47 +++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
402e8bb70b6e2e2c0b1da66065566a35f91c0eb9
diff --git a/dlls/lz32/tests/lzexpand_main.c b/dlls/lz32/tests/lzexpand_main.c
index 0a895b7..96547de 100644
--- a/dlls/lz32/tests/lzexpand_main.c
+++ b/dlls/lz32/tests/lzexpand_main.c
@@ -389,6 +389,32 @@ static void test_LZOpenFileA(void)
ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA: error %ld\n",
GetLastError());
+ memset(&test, 0xA5, sizeof(test));
+ full_file_path_name_in_a_CWD(filename_, short_expected, TRUE);
+ SetLastError(0xfaceabee);
+
+ /* Try creating empty file which already should exist. */
+ file = LZOpenFileA(filename_, &test, OF_CREATE);
+ ok(file >= 0, "LZOpenFileA failed on creation\n");
+ todo_wine
+ ok(GetLastError() == ERROR_BAD_PATHNAME ||
+ GetLastError() == ERROR_ALREADY_EXISTS,
+ "GetLastError() returns %ld\n", GetLastError());
+ ok(test.cBytes == sizeof(OFSTRUCT),
+ "LZOpenFileA set test.cBytes to %d\n", test.cBytes);
+ ok(test.nErrCode == ERROR_SUCCESS ||
+ test.nErrCode == ERROR_ALREADY_EXISTS,
+ "LZOpenFileA set test.nErrCode to %d\n", test.nErrCode);
+ ok(lstrcmpA(test.szPathName, expected) == 0 ||
+ lstrcmpA(test.szPathName, short_expected) == 0, /* Win9x */
+ "LZOpenFileA returned '%s', but was expected to return '%s'\n",
+ test.szPathName, expected);
+ LZClose(file);
+
+ retval = GetFileAttributesA(filename_);
+ ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA: error %ld\n",
+ GetLastError());
+
/* Check various opening options: */
memset(&test, 0xA5, sizeof(test));
SetLastError(0xfaceabee);
@@ -818,6 +844,27 @@ static void test_LZOpenFileW(void)
ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributes: error %ld\n",
GetLastError());
+ SetLastError(0xfaceabee);
+ /* Try creating empty file which already should exist. */
+ file = LZOpenFileW(filenameW_, &test, OF_CREATE);
+ todo_wine
+ ok(GetLastError() == ERROR_ALREADY_EXISTS,
+ "GetLastError() returns %ld\n", GetLastError());
+ ok(file >= 0, "LZOpenFile failed on creation\n");
+ ok(test.cBytes == sizeof(OFSTRUCT),
+ "LZOpenFileW set test.cBytes to %d\n", test.cBytes);
+ todo_wine
+ ok(test.nErrCode == ERROR_ALREADY_EXISTS,
+ "LZOpenFileW set test.nErrCode to %d\n", test.nErrCode);
+ ok(lstrcmpA(test.szPathName, expected) == 0,
+ "LZOpenFileW returned '%s', but was expected to return '%s'\n",
+ test.szPathName, expected);
+ LZClose(file);
+
+ retval = GetFileAttributesW(filenameW_);
+ ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributes: error %ld\n",
+ GetLastError());
+
/* Check various opening options: */
memset(&test, 0xA5, sizeof(test));
--
1.3.3
More information about the wine-patches
mailing list