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
88a01995
Commit
88a01995
authored
Aug 21, 2009
by
Stefan Leichter
Committed by
Alexandre Julliard
Aug 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Test GetPrivateProfileString with empty string as key and section.
parent
9c0a3eab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
profile.c
dlls/kernel32/tests/profile.c
+30
-0
No files found.
dlls/kernel32/tests/profile.c
View file @
88a01995
...
...
@@ -92,14 +92,23 @@ static void test_profile_int(void)
static
void
test_profile_string
(
void
)
{
static
WCHAR
emptyW
[]
=
{
0
};
static
WCHAR
keyW
[]
=
{
'k'
,
'e'
,
'y'
,
0
};
static
WCHAR
sW
[]
=
{
's'
,
0
};
static
WCHAR
TESTFILE2W
[]
=
{
'.'
,
'\\'
,
't'
,
'e'
,
's'
,
't'
,
'w'
,
'i'
,
'n'
,
'e'
,
'2'
,
'.'
,
'i'
,
'n'
,
'i'
,
0
};
static
WCHAR
valsectionW
[]
=
{
'v'
,
'a'
,
'l'
,
'_'
,
'e'
,
'_'
,
's'
,
'e'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
WCHAR
valnokeyW
[]
=
{
'v'
,
'a'
,
'l'
,
'_'
,
'n'
,
'o'
,
'_'
,
'k'
,
'e'
,
'y'
,
0
};
HANDLE
h
;
int
ret
;
DWORD
count
;
char
buf
[
100
];
WCHAR
bufW
[
100
];
char
*
p
;
/* test that lines without an '=' will not be enumerated */
/* in the case below, name2 is a key while name3 is not. */
char
content
[]
=
"[s]
\r\n
name1=val1
\r\n
name2=
\r\n
name3
\r\n
name4=val4
\r\n
"
;
char
content2
[]
=
"
\r\n
key=val_no_section
\r\n
[]
\r\n
key=val_e_section
\r\n
"
"[s]
\r\n
=val_no_key
\r\n
[t]
\r\n
"
;
DeleteFileA
(
TESTFILE2
);
h
=
CreateFileA
(
TESTFILE2
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -126,6 +135,27 @@ static void test_profile_string(void)
ok
(
ret
==
24
&&
!
strcmp
(
buf
,
"name1,name2,name4,name5"
),
"wrong keys returned(%d): %s
\n
"
,
ret
,
buf
);
h
=
CreateFileA
(
TESTFILE2
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
h
!=
INVALID_HANDLE_VALUE
,
" cannot create %s
\n
"
,
TESTFILE2
);
if
(
h
==
INVALID_HANDLE_VALUE
)
return
;
WriteFile
(
h
,
content2
,
sizeof
(
content2
),
&
count
,
NULL
);
CloseHandle
(
h
);
/* works only in unicode, ascii crashes */
ret
=
GetPrivateProfileStringW
(
emptyW
,
keyW
,
emptyW
,
bufW
,
sizeof
(
bufW
)
/
sizeof
(
bufW
[
0
]),
TESTFILE2W
);
todo_wine
ok
(
!
lstrcmpW
(
valsectionW
,
bufW
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
valsectionW
),
wine_dbgstr_w
(
bufW
)
);
/* works only in unicode, ascii crashes */
ret
=
GetPrivateProfileStringW
(
sW
,
emptyW
,
emptyW
,
bufW
,
sizeof
(
bufW
)
/
sizeof
(
bufW
[
0
]),
TESTFILE2W
);
todo_wine
ok
(
!
lstrcmpW
(
valnokeyW
,
bufW
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
valnokeyW
),
wine_dbgstr_w
(
bufW
)
);
DeleteFileA
(
TESTFILE2
);
}
...
...
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