kernel32/tests: Print some more details on directory test failures.

This commit is contained in:
Alexandre Julliard 2009-02-03 15:01:41 +01:00
parent 69a8066b18
commit e8d36ff9a1
1 changed files with 16 additions and 9 deletions

View File

@ -339,27 +339,32 @@ static void test_CreateDirectoryW(void)
ret = CreateDirectoryW(NULL, NULL);
if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path\n");
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"should not create NULL path ret %u err %u\n", ret, GetLastError());
ret = CreateDirectoryW(empty_strW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path\n");
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"should not create empty path ret %u err %u\n", ret, GetLastError());
ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
ret = SetCurrentDirectoryW(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory\n");
ok(ret == TRUE, "could not chdir to the System directory ret %u err %u\n", ret, GetLastError());
ret = CreateDirectoryW(dotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
ret = CreateDirectoryW(dotdotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
GetTempPathW(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root\n");
ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED,
"should deny access to the drive root ret %u err %u\n", ret, GetLastError());
GetTempPathW(MAX_PATH, tmpdir);
lstrcatW(tmpdir, tmp_dir_name);
@ -367,7 +372,8 @@ static void test_CreateDirectoryW(void)
ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
@ -391,8 +397,9 @@ static void test_CreateDirectoryW(void)
lstrcatW(tmpdir, slashW);
lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateDirectoryW with multiple nonexistent directories in path should fail\n");
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateDirectoryW with multiple nonexistent directories in path should fail ret %u err %u\n",
ret, GetLastError());
ret = RemoveDirectoryW(tmpdir);
}