Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
ad064915
Commit
ad064915
authored
Jun 29, 2006
by
James Hawkins
Committed by
Alexandre Julliard
Jun 30, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Add tests for PathFindExtensionA.
parent
b333f0c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
path.c
dlls/shlwapi/tests/path.c
+67
-0
No files found.
dlls/shlwapi/tests/path.c
View file @
ad064915
...
...
@@ -1419,6 +1419,72 @@ static void test_PathCanonicalizeA(void)
ok
(
lstrlen
(
too_long
)
==
LONG_LEN
-
1
,
"Expected length LONG_LEN - 1, got %i
\n
"
,
lstrlen
(
too_long
));
}
static
void
test_PathFindExtensionA
(
void
)
{
LPSTR
ext
;
char
path
[
MAX_PATH
];
char
too_long
[
LONG_LEN
];
/* try a NULL path */
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
NULL
);
ok
(
ext
==
NULL
,
"Expected NULL, got %p
\n
"
,
ext
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try an empty path */
path
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
path
);
ok
(
ext
==
path
,
"Expected ext == path, got %p
\n
"
,
ext
);
ok
(
lstrlen
(
ext
)
==
0
,
"Expected length 0, got %i
\n
"
,
lstrlen
(
ext
));
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try a path without an extension */
lstrcpy
(
path
,
"file"
);
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
path
);
ok
(
ext
==
path
+
lstrlen
(
path
),
"Expected ext == path, got %p
\n
"
,
ext
);
ok
(
lstrlen
(
ext
)
==
0
,
"Expected length 0, got %i
\n
"
,
lstrlen
(
ext
));
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try a path with an extension */
lstrcpy
(
path
,
"file.txt"
);
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
path
);
ok
(
ext
==
path
+
lstrlen
(
"file"
),
"Expected ext == path + lstrlen(
\"
file
\"
), got %p
\n
"
,
ext
);
ok
(
!
lstrcmp
(
ext
,
".txt"
),
"Expected .txt, got %s
\n
"
,
ext
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try a path with two extensions */
lstrcpy
(
path
,
"file.txt.doc"
);
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
path
);
ok
(
ext
==
path
+
lstrlen
(
"file.txt"
),
"Expected ext == path + lstrlen(
\"
file.txt
\"
), got %p
\n
"
,
ext
);
ok
(
!
lstrcmp
(
ext
,
".doc"
),
"Expected .txt, got %s
\n
"
,
ext
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try a path longer than MAX_PATH without an extension*/
memset
(
too_long
,
'a'
,
LONG_LEN
);
too_long
[
LONG_LEN
-
1
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
too_long
);
ok
(
ext
==
too_long
+
LONG_LEN
-
1
,
"Expected ext == too_long + LONG_LEN - 1, got %p
\n
"
,
ext
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try a path longer than MAX_PATH with an extension*/
memset
(
too_long
,
'a'
,
LONG_LEN
);
too_long
[
LONG_LEN
-
1
]
=
'\0'
;
lstrcpy
(
too_long
+
300
,
".abcde"
);
too_long
[
lstrlen
(
too_long
)]
=
'a'
;
SetLastError
(
0xdeadbeef
);
ext
=
PathFindExtensionA
(
too_long
);
ok
(
ext
==
too_long
+
300
,
"Expected ext == too_long + 300, got %p
\n
"
,
ext
);
ok
(
lstrlen
(
ext
)
==
LONG_LEN
-
301
,
"Expected LONG_LEN - 301, got %i
\n
"
,
lstrlen
(
ext
));
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
}
START_TEST
(
path
)
{
hShlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
...
...
@@ -1460,4 +1526,5 @@ START_TEST(path)
test_PathCombineA
();
test_PathAppendA
();
test_PathCanonicalizeA
();
test_PathFindExtensionA
();
}
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