Stefan Leichter : kernel32: Test GetPrivateProfileString with empty string as key and section.
Alexandre Julliard
julliard at winehq.org
Fri Aug 21 09:32:46 CDT 2009
Module: wine
Branch: master
Commit: 88a019956e0a1c5c4d6bbdb75c696bca928c54f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=88a019956e0a1c5c4d6bbdb75c696bca928c54f1
Author: Stefan Leichter <Stefan.Leichter at camline.com>
Date: Fri Aug 21 13:03:37 2009 +0200
kernel32: Test GetPrivateProfileString with empty string as key and section.
---
dlls/kernel32/tests/profile.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index b9a71d3..4254c85 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -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\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n";
+ char content2[]="\r\nkey=val_no_section\r\n[]\r\nkey=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);
}
More information about the wine-cvs
mailing list