Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2b03aa6a
Commit
2b03aa6a
authored
Jun 30, 2005
by
Francois Gouget
Committed by
Alexandre Julliard
Jun 30, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test the behavior of CreateDirectory() when it has one or two trailing
dots or spaces. Tweak the previous CreateDirectory() tests so we get more information in case of a failure.
parent
355f0127
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
17 deletions
+124
-17
directory.c
dlls/kernel/tests/directory.c
+124
-17
No files found.
dlls/kernel/tests/directory.c
View file @
2b03aa6a
...
@@ -156,12 +156,12 @@ static void test_CreateDirectoryA(void)
...
@@ -156,12 +156,12 @@ static void test_CreateDirectoryA(void)
ret
=
CreateDirectoryA
(
NULL
,
NULL
);
ret
=
CreateDirectoryA
(
NULL
,
NULL
);
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
||
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
||
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
GetLastError
()
==
ERROR_INVALID_PARAMETER
),
"CreateDirectoryA(NULL
,NULL): ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
"CreateDirectoryA(NULL
): ret=%d err=%ld
\n
"
,
ret
,
GetLastError
());
ret
=
CreateDirectoryA
(
""
,
NULL
);
ret
=
CreateDirectoryA
(
""
,
NULL
);
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_BAD_PATHNAME
||
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_BAD_PATHNAME
||
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
"CreateDirectoryA(
\"\"
,NULL): ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
"CreateDirectoryA(
%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
ret
=
GetSystemDirectoryA
(
tmpdir
,
MAX_PATH
);
ret
=
GetSystemDirectoryA
(
tmpdir
,
MAX_PATH
);
ok
(
ret
<
MAX_PATH
,
"System directory should fit into MAX_PATH
\n
"
);
ok
(
ret
<
MAX_PATH
,
"System directory should fit into MAX_PATH
\n
"
);
...
@@ -170,52 +170,159 @@ static void test_CreateDirectoryA(void)
...
@@ -170,52 +170,159 @@ static void test_CreateDirectoryA(void)
ok
(
ret
==
TRUE
,
"could not chdir to the System directory
\n
"
);
ok
(
ret
==
TRUE
,
"could not chdir to the System directory
\n
"
);
ret
=
CreateDirectoryA
(
"."
,
NULL
);
ret
=
CreateDirectoryA
(
"."
,
NULL
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"should not create existing path
\n
"
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
ret
=
CreateDirectoryA
(
".."
,
NULL
);
ret
=
CreateDirectoryA
(
".."
,
NULL
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"should not create existing path
\n
"
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
GetTempPathA
(
MAX_PATH
,
tmpdir
);
GetTempPathA
(
MAX_PATH
,
tmpdir
);
tmpdir
[
3
]
=
0
;
/* truncate the path */
tmpdir
[
3
]
=
0
;
/* truncate the path */
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
||
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
||
GetLastError
()
==
ERROR_ACCESS_DENIED
),
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"CreateDirectoryA(
drive_root): ret=%d error=%ld
\n
"
,
ret
,
GetLastError
());
"CreateDirectoryA(
%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
GetTempPathA
(
MAX_PATH
,
tmpdir
);
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA should always succeed
\n
"
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
()
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"should not create existing path
\n
"
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
ret
=
RemoveDirectoryA
(
tmpdir
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA should always succeed
\n
"
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
lstrcatA
(
tmpdir
,
"?"
);
lstrcatA
(
tmpdir
,
"?"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_INVALID_NAME
||
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_INVALID_NAME
||
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
"CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld
\n
"
,
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
ret
?
" True"
:
"False"
,
GetLastError
());
RemoveDirectoryA
(
tmpdir
);
ret
=
RemoveDirectoryA
(
tmpdir
);
tmpdir
[
lstrlenA
(
tmpdir
)
-
1
]
=
'*'
;
tmpdir
[
lstrlenA
(
tmpdir
)
-
1
]
=
'*'
;
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_INVALID_NAME
||
ok
(
ret
==
FALSE
&&
(
GetLastError
()
==
ERROR_INVALID_NAME
||
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
"CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld
\n
"
,
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
ret
?
" True"
:
"False"
,
GetLastError
());
RemoveDirectoryA
(
tmpdir
);
ret
=
RemoveDirectoryA
(
tmpdir
);
GetTempPathA
(
MAX_PATH
,
tmpdir
);
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me/Please Remove Me"
);
lstrcatA
(
tmpdir
,
"Please Remove Me/Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
ok
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"CreateDirectoryA with multiple nonexistent directories in path should fail
\n
"
);
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
RemoveDirectoryA
(
tmpdir
);
/* Test behavior with a trailing dot.
* The directory should be created without the dot.
*/
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me."
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
lstrcatA
(
tmpdir
,
"/Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
ret
=
RemoveDirectoryA
(
tmpdir
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
/* Test behavior with two trailing dots.
* The directory should be created without the trailing dots.
*/
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me.."
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
lstrcatA
(
tmpdir
,
"/Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
||
/* On Win98 */
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
/* On NT! */
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
if
(
ret
==
TRUE
)
{
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
}
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
/* Test behavior with a trailing space.
* The directory should be created without the trailing space.
*/
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me "
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
lstrcatA
(
tmpdir
,
"/Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
||
/* On Win98 */
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
/* On NT! */
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
if
(
ret
==
TRUE
)
{
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
}
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
/* Test behavior with a trailing space.
* The directory should be created without the trailing spaces.
*/
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me "
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
,
"CreateDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
lstrcatA
(
tmpdir
,
"/Please Remove Me"
);
ret
=
CreateDirectoryA
(
tmpdir
,
NULL
);
ok
(
ret
==
TRUE
||
/* On Win98 */
(
ret
==
FALSE
&&
GetLastError
()
==
ERROR_PATH_NOT_FOUND
),
/* On NT! */
"CreateDirectoryA(%s): ret=%d err=%ld
\n
"
,
tmpdir
,
ret
,
GetLastError
());
if
(
ret
==
TRUE
)
{
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
}
GetTempPathA
(
MAX_PATH
,
tmpdir
);
lstrcatA
(
tmpdir
,
"Please Remove Me"
);
ret
=
RemoveDirectoryA
(
tmpdir
);
ok
(
ret
==
TRUE
,
"RemoveDirectoryA(%s) failed err=%ld
\n
"
,
tmpdir
,
GetLastError
());
}
}
static
void
test_CreateDirectoryW
(
void
)
static
void
test_CreateDirectoryW
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment