mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 05:00:30 +00:00
shlwapi: Add tests for PathAddBackslash.
This commit is contained in:
parent
7412bddd36
commit
251d76888d
@ -1072,6 +1072,68 @@ static void test_PathCombineA(void)
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_PathAddBackslash(void)
|
||||
{
|
||||
LPSTR str;
|
||||
char path[MAX_PATH];
|
||||
char too_long[LONG_LEN];
|
||||
|
||||
/* try a NULL path */
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(NULL);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try an empty path */
|
||||
path[0] = '\0';
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(lstrlenA(path) == 0, "Expected empty string, got %i\n", lstrlenA(path));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try a relative path */
|
||||
lstrcpyA(path, "one\\two");
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmp(path, "one\\two\\"), "Expected one\\two\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try periods */
|
||||
lstrcpyA(path, "one\\..\\two");
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmp(path, "one\\..\\two\\"), "Expected one\\..\\two\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* try just a space */
|
||||
lstrcpyA(path, " ");
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmp(path, " \\"), "Expected \\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
/* path already has backslash */
|
||||
lstrcpyA(path, "C:\\one\\");
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(!lstrcmp(path, "C:\\one\\"), "Expected C:\\one\\, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
too_long[LONG_LEN - 1] = '\0';
|
||||
|
||||
/* path is longer than MAX_PATH */
|
||||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(too_long);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
START_TEST(path)
|
||||
{
|
||||
hShlwapi = LoadLibraryA("shlwapi.dll");
|
||||
@ -1090,6 +1152,7 @@ START_TEST(path)
|
||||
test_PathCreateFromUrl();
|
||||
test_PathIsUrl();
|
||||
|
||||
test_PathAddBackslash();
|
||||
test_PathMakePretty();
|
||||
test_PathMatchSpec();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user