Paul Vriens : kernel32/profile: Move GetPrivateProfileSectionA to its own test.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 28 06:41:48 CDT 2007


Module: wine
Branch: master
Commit: 0230695a29d4fd807087de7c766430fd969966a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0230695a29d4fd807087de7c766430fd969966a6

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Tue Mar 27 22:08:07 2007 +0200

kernel32/profile: Move GetPrivateProfileSectionA to its own test.

---

 dlls/kernel32/tests/profile.c |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index 64fee87..0893c1c 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -116,13 +116,6 @@ static void test_profile_string(void)
     ok( ret == 18 && !strcmp( buf, "name1,name2,name4"), "wrong keys returned(%d): %s\n", ret,
             buf);
 
-    ret=GetPrivateProfileSectionA("s", buf, sizeof(buf), TESTFILE2);
-    for( p = buf + strlen(buf) + 1; *p;p += strlen(p)+1) 
-        p[-1] = ',';
-    /* and test */
-    ok( ret == 35 && !strcmp( buf, "name1=val1,name2=,name3,name4=val4"), "wrong section returned(%d): %s\n",
-            ret, buf);
-    
     /* add a new key to test that the file is quite usable */
     WritePrivateProfileStringA( "s", "name5", "val5", TESTFILE2); 
     ret=GetPrivateProfileStringA( "s", NULL, "", buf, sizeof(buf),
@@ -135,6 +128,33 @@ static void test_profile_string(void)
     DeleteFileA( TESTFILE2);
 }
 
+static void test_profile_sections(void)
+{
+    HANDLE h;
+    int ret;
+    DWORD count;
+    char buf[100];
+    char *p;
+    static const char content[]="[s]\r\nname1=val1\r\nname2=\r\nname3\r\nname4=val4\r\n";
+    static const char testfile4[]=".\\testwine4.ini";
+
+    DeleteFileA( testfile4 );
+    h = CreateFileA( testfile4, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    ok( h != INVALID_HANDLE_VALUE, " cannot create %s\n", testfile4);
+    if( h == INVALID_HANDLE_VALUE) return;
+    WriteFile( h, content, sizeof(content), &count, NULL);
+    CloseHandle( h);
+
+    ret=GetPrivateProfileSectionA("s", buf, sizeof(buf), testfile4);
+    for( p = buf + strlen(buf) + 1; *p;p += strlen(p)+1)
+        p[-1] = ',';
+    /* and test */
+    ok( ret == 35 && !strcmp( buf, "name1=val1,name2=,name3,name4=val4"), "wrong section returned(%d): %s\n",
+            ret, buf);
+
+    DeleteFileA( testfile4 );
+}
+
 static void test_profile_sections_names(void)
 {
     HANDLE h;
@@ -205,5 +225,6 @@ START_TEST(profile)
 {
     test_profile_int();
     test_profile_string();
+    test_profile_sections();
     test_profile_sections_names();
 }




More information about the wine-cvs mailing list