Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
3a1a607a
Commit
3a1a607a
authored
18 years ago
by
James Hawkins
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
shlwapi: Add tests for PathAppendA.
parent
ce9471f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/shlwapi/tests/path.c
+134
-0
134 additions, 0 deletions
dlls/shlwapi/tests/path.c
with
134 additions
and
0 deletions
dlls/shlwapi/tests/path.c
+
134
−
0
View file @
3a1a607a
...
...
@@ -1163,6 +1163,139 @@ static void test_PathAddBackslash(void)
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
}
static
void
test_PathAppendA
(
void
)
{
char
path
[
MAX_PATH
];
char
too_long
[
LONG_LEN
];
char
one
[
HALF_LEN
],
two
[
HALF_LEN
];
BOOL
res
;
lstrcpy
(
path
,
"C:
\\
one"
);
/* try NULL pszMore */
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
NULL
);
ok
(
!
res
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one"
),
"Expected C:
\\
one, got %s
\n
"
,
path
);
/* try empty pszMore */
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
""
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one"
),
"Expected C:
\\
one, got %s
\n
"
,
path
);
/* try NULL pszPath */
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
NULL
,
"two
\\
three"
);
ok
(
!
res
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
/* try empty pszPath */
path
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"two
\\
three"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"two
\\
three"
),
"Expected
\\
two
\\
three, got %s
\n
"
,
path
);
/* try empty pszPath and empty pszMore */
path
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
""
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"
\\
"
),
"Expected
\\
, got %s
\n
"
,
path
);
/* try legit params */
lstrcpy
(
path
,
"C:
\\
one"
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"two
\\
three"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three"
),
"Expected C:
\\
one
\\
two
\\
three, got %s
\n
"
,
path
);
/* try pszPath with backslash after it */
lstrcpy
(
path
,
"C:
\\
one
\\
"
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"two
\\
three"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three"
),
"Expected C:
\\
one
\\
two
\\
three, got %s
\n
"
,
path
);
/* try pszMore with backslash before it */
lstrcpy
(
path
,
"C:
\\
one"
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"
\\
two
\\
three"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three"
),
"Expected C:
\\
one
\\
two
\\
three, got %s
\n
"
,
path
);
/* try pszMore with backslash after it */
lstrcpy
(
path
,
"C:
\\
one"
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"two
\\
three
\\
"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three
\\
"
),
"Expected C:
\\
one
\\
two
\\
three
\\
, got %s
\n
"
,
path
);
/* try spaces in pszPath */
lstrcpy
(
path
,
"C:
\\
one "
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
"two
\\
three"
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three"
),
"Expected C:
\\
one
\\
two
\\
three, got %s
\n
"
,
path
);
/* try spaces in pszMore */
lstrcpy
(
path
,
"C:
\\
one"
);
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
" two
\\
three "
);
ok
(
res
,
"Expected success
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
!
lstrcmp
(
path
,
"C:
\\
one
\\
two
\\
three "
),
"Expected 'C:
\\
one
\\
two
\\
three ', got %s
\n
"
,
path
);
/* pszPath is too long */
memset
(
too_long
,
'a'
,
LONG_LEN
);
too_long
[
LONG_LEN
-
1
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
too_long
,
"two
\\
three"
);
todo_wine
{
ok
(
!
res
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
lstrlen
(
too_long
)
==
0
,
"Expected length of too_long to be zero, got %i
\n
"
,
lstrlen
(
too_long
));
}
/* pszMore is too long */
lstrcpy
(
path
,
"C:
\\
one"
);
memset
(
too_long
,
'a'
,
LONG_LEN
);
too_long
[
LONG_LEN
-
1
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
path
,
too_long
);
todo_wine
{
ok
(
!
res
,
"Expected failure
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
ok
(
lstrlen
(
path
)
==
0
,
"Expected length of path to be zero, got %i
\n
"
,
lstrlen
(
path
));
}
/* both params combined are too long */
memset
(
one
,
'a'
,
HALF_LEN
);
one
[
HALF_LEN
-
1
]
=
'\0'
;
memset
(
two
,
'b'
,
HALF_LEN
);
two
[
HALF_LEN
-
1
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
PathAppendA
(
one
,
two
);
todo_wine
{
ok
(
!
res
,
"Expected failure
\n
"
);
ok
(
lstrlen
(
one
)
==
0
,
"Expected length of one to be zero, got %i
\n
"
,
lstrlen
(
one
));
}
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %ld
\n
"
,
GetLastError
());
}
START_TEST
(
path
)
{
hShlwapi
=
LoadLibraryA
(
"shlwapi.dll"
);
...
...
@@ -1202,4 +1335,5 @@ START_TEST(path)
test_PathCombineW
();
test_PathCombineA
();
test_PathAppendA
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment