Commit ceb57b78 authored by Joachim Priesner's avatar Joachim Priesner Committed by Alexandre Julliard

kernel32/tests: Add tests for GetDriveType with invalid drive spec.

parent 1ea99a8f
......@@ -30,6 +30,7 @@ static DWORD (WINAPI *pGetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INT
static void test_GetDriveTypeA(void)
{
char drive[] = "?:\\";
char existing_drive_letter = 0;
DWORD logical_drives;
UINT type;
......@@ -46,14 +47,43 @@ static void test_GetDriveTypeA(void)
ok(type == DRIVE_NO_ROOT_DIR,
"GetDriveTypeA should return DRIVE_NO_ROOT_DIR for inexistent drive %c: but not %u\n",
drive[0], type);
else if (type != DRIVE_NO_ROOT_DIR)
existing_drive_letter = drive[0];
logical_drives >>= 1;
}
if (!existing_drive_letter) {
skip("No drives found, skipping drive spec format tests.\n");
return;
}
drive[0] = existing_drive_letter;
drive[2] = 0; /* C: */
type = GetDriveTypeA(drive);
ok(type > DRIVE_NO_ROOT_DIR && type <= DRIVE_RAMDISK, "got %u for drive spec '%s'\n", type, drive);
drive[1] = '?'; /* C? */
type = GetDriveTypeA(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, drive);
drive[1] = 0; /* C */
type = GetDriveTypeA(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, drive);
drive[0] = '?'; /* the string "?" */
type = GetDriveTypeA(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, drive);
drive[0] = 0; /* the empty string */
type = GetDriveTypeA(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, drive);
}
static void test_GetDriveTypeW(void)
{
WCHAR drive[] = {'?',':','\\',0};
WCHAR existing_drive_letter = 0;
DWORD logical_drives;
UINT type;
......@@ -70,9 +100,38 @@ static void test_GetDriveTypeW(void)
ok(type == DRIVE_NO_ROOT_DIR,
"GetDriveTypeW should return DRIVE_NO_ROOT_DIR for inexistent drive %c: but not %u\n",
drive[0], type);
else if (type != DRIVE_NO_ROOT_DIR)
existing_drive_letter = drive[0];
logical_drives >>= 1;
}
if (!existing_drive_letter) {
skip("No drives found, skipping drive spec format tests.\n");
return;
}
drive[0] = existing_drive_letter;
drive[2] = 0; /* C: */
type = GetDriveTypeW(drive);
ok(type > DRIVE_NO_ROOT_DIR && type <= DRIVE_RAMDISK, "got %u for drive spec '%s'\n",
type, wine_dbgstr_w(drive));
drive[1] = '?'; /* C? */
type = GetDriveTypeW(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, wine_dbgstr_w(drive));
drive[1] = 0; /* C */
type = GetDriveTypeW(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, wine_dbgstr_w(drive));
drive[0] = '?'; /* the string "?" */
type = GetDriveTypeW(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, wine_dbgstr_w(drive));
drive[0] = 0; /* the empty string */
type = GetDriveTypeW(drive);
ok(type == DRIVE_NO_ROOT_DIR, "got %u for drive spec '%s'\n", type, wine_dbgstr_w(drive));
}
static void test_GetDiskFreeSpaceA(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment