Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
6ad1ef7a
Commit
6ad1ef7a
authored
Dec 01, 2007
by
Zac Brown
Committed by
Alexandre Julliard
Dec 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Add test for FtpGetCurrentDirectoryA in wininet/tests/ftp.c.
parent
b9b900f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
ftp.c
dlls/wininet/tests/ftp.c
+84
-0
No files found.
dlls/wininet/tests/ftp.c
View file @
6ad1ef7a
...
...
@@ -691,6 +691,89 @@ static void test_command(HINTERNET hFtp, HINTERNET hConnect)
}
}
static
void
test_get_current_dir
(
HINTERNET
hFtp
,
HINTERNET
hConnect
)
{
BOOL
bRet
;
DWORD
dwCurrentDirectoryLen
=
MAX_PATH
;
CHAR
lpszCurrentDirectory
[
MAX_PATH
];
/* change directories to get a more interesting pwd */
bRet
=
FtpCommandA
(
hFtp
,
FALSE
,
FTP_TRANSFER_TYPE_ASCII
,
"CWD pub/"
,
0
,
NULL
);
if
(
bRet
==
FALSE
)
{
skip
(
"Failed to change directories in test_get_current_dir(HINTERNET hFtp).
\n
"
);
return
;
}
/* test with all NULL arguments */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
NULL
,
NULL
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got: %d
\n
"
,
GetLastError
());
/* test with NULL parameters instead of expected LPSTR/LPDWORD */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
NULL
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got: %d
\n
"
,
GetLastError
());
/* test with no valid handle and valid parameters */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
NULL
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got: %d
\n
"
,
GetLastError
());
/* test with invalid dwCurrentDirectory and all other parameters correct */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
0
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got: %d
\n
"
,
GetLastError
());
/* test with invalid lpszCurrentDirectory and all other parameters correct */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
NULL
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got: %d
\n
"
,
GetLastError
());
/* test to show it checks the handle type */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hConnect
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
,
"Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got: %d
\n
"
,
GetLastError
());
/* test for the current directory with legitimate values */
SetLastError
(
0xdeadbeef
);
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
TRUE
,
"Expected FtpGetCurrentDirectoryA to pass
\n
"
);
todo_wine
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
==
0
,
"Expected returned value
\"
%s
\"
to match
\"
%s
\"
\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got: %d
\n
"
,
GetLastError
());
/* test for the current directory with a size only large enough to
* fit the string and not the null terminating character */
SetLastError
(
0xdeadbeef
);
dwCurrentDirectoryLen
=
4
;
lpszCurrentDirectory
[
4
]
=
'a'
;
/* set position 4 of the array to something else to make sure a leftover \0 isn't fooling the test */
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
todo_wine
ok
(
bRet
==
FALSE
,
"Expected FtpGetCurrentDirectoryA to fail
\n
"
);
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
!=
0
,
"Expected returned value
\"
%s
\"
to not match
\"
%s
\"
\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got: %d
\n
"
,
GetLastError
());
/* test for the current directory with a size large enough to store
* the expected string as well as the null terminating character */
SetLastError
(
0xdeadbeef
);
dwCurrentDirectoryLen
=
5
;
bRet
=
FtpGetCurrentDirectoryA
(
hFtp
,
lpszCurrentDirectory
,
&
dwCurrentDirectoryLen
);
ok
(
bRet
==
TRUE
,
"Expected FtpGetCurrentDirectoryA to pass
\n
"
);
todo_wine
ok
(
lstrcmp
(
lpszCurrentDirectory
,
"/pub"
)
==
0
,
"Expected returned value
\"
%s
\"
to match
\"
%s
\"
\n
"
,
(
char
*
)
lpszCurrentDirectory
,
"/pub"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got: %d
\n
"
,
GetLastError
());
}
START_TEST
(
ftp
)
{
HANDLE
hInternet
,
hFtp
,
hHttp
;
...
...
@@ -733,6 +816,7 @@ START_TEST(ftp)
test_removedir
(
hFtp
,
hHttp
);
test_renamefile
(
hFtp
,
hHttp
);
test_command
(
hFtp
,
hHttp
);
test_get_current_dir
(
hFtp
,
hHttp
);
InternetCloseHandle
(
hHttp
);
InternetCloseHandle
(
hFtp
);
...
...
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