shell32/tests: Don't test functions directly when reporting GetLastError().

Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
André Hentschel 2017-12-30 19:57:54 +01:00 committed by Alexandre Julliard
parent 5200f3472f
commit 063fd7a665
1 changed files with 11 additions and 5 deletions

View File

@ -387,6 +387,7 @@ static void test_items(void)
HANDLE file;
BSTR bstr;
char cstr[64];
BOOL ret;
int i;
r = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, &IID_IShellDispatch, (void**)&sd);
@ -397,7 +398,8 @@ static void test_items(void)
GetTempPathW(MAX_PATH, path);
GetCurrentDirectoryW(MAX_PATH, orig_dir);
SetCurrentDirectoryW(path);
ok(CreateDirectoryW(winetestW, NULL), "CreateDirectory failed: %08x\n", GetLastError());
ret = CreateDirectoryW(winetestW, NULL);
ok(ret, "CreateDirectory failed: %08x\n", GetLastError());
GetFullPathNameW(winetestW, MAX_PATH, path, NULL);
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(path);
@ -673,7 +675,8 @@ static void test_items(void)
VariantClear(&str_index2);
/* delete the file in the subdirectory */
ok(DeleteFileA(cstr), "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
ret = DeleteFileA(cstr);
ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
/* test that getting an item object via a relative path fails */
strcpy(cstr, file_defs[i].name);
@ -690,11 +693,13 @@ static void test_items(void)
VariantClear(&str_index2);
/* remove the directory */
ok(RemoveDirectoryA(file_defs[i].name), "file_defs[%d]: RemoveDirectory failed: %08x\n", i, GetLastError());
ret = RemoveDirectoryA(file_defs[i].name);
ok(ret, "file_defs[%d]: RemoveDirectory failed: %08x\n", i, GetLastError());
}
else
{
ok(DeleteFileA(file_defs[i].name), "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
ret = DeleteFileA(file_defs[i].name);
ok(ret, "file_defs[%d]: DeleteFile failed: %08x\n", i, GetLastError());
}
/* test that the folder item is still accessible by integer index */
@ -789,7 +794,8 @@ todo_wine
/* remove the temporary directory and restore the original working directory */
GetTempPathW(MAX_PATH, path);
SetCurrentDirectoryW(path);
ok(RemoveDirectoryW(winetestW), "RemoveDirectory failed: %08x\n", GetLastError());
ret = RemoveDirectoryW(winetestW);
ok(ret, "RemoveDirectory failed: %08x\n", GetLastError());
SetCurrentDirectoryW(orig_dir);
/* test that everything stops working after the directory has been removed */