Carlos Rivera : kernel32/tests: Use debugstr_an to show contents of buffer.
Module: wine Branch: master Commit: 13e81421b7f1c9cfe1d6a5a7738ac728c662788c URL: https://source.winehq.org/git/wine.git/?a=commit;h=13e81421b7f1c9cfe1d6a5a77... Author: Carlos Rivera <carlos(a)superkaos.org> Date: Mon Aug 31 11:37:23 2020 +0200 kernel32/tests: Use debugstr_an to show contents of buffer. In the tests modified the buffer to show is expected to contain strings separated by \0. So that passing the buffer to the ok macro will only print the first string. Showing the whole returned buffer gives more information when the test fails. Signed-off-by: Carlos Rivera <carlos(a)superkaos.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/profile.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c index 2fba26542f..c077f8b35b 100644 --- a/dlls/kernel32/tests/profile.c +++ b/dlls/kernel32/tests/profile.c @@ -591,8 +591,10 @@ static void test_GetPrivateProfileString(const char *content, const char *descri buf, MAX_PATH, filename); ok(ret == 18, "Expected 18, got %d\n", ret); len = lstrlenA("section1") + sizeof(CHAR) + lstrlenA("section2") + 2 * sizeof(CHAR); - ok(!memcmp(buf, "section1\0section2\0\0", len), - "Expected \"section1\\0section2\\0\\0\", got \"%s\"\n", buf); + + ok(!memcmp(buf, "section1\0section2\0", len), + "Expected \"section1\\x00section2\\x00\\x00\", got %s\n", + debugstr_an(buf, (ret + 2 >= MAX_PATH ? MAX_PATH : ret + 1))); /* lpAppName is empty */ memset(buf, 0xc, sizeof(buf)); @@ -667,7 +669,8 @@ static void test_GetPrivateProfileString(const char *content, const char *descri buf, MAX_PATH, filename); ok(ret == 18, "Expected 18, got %d\n", ret); ok(!memcmp(buf, "name1\0name2\0name4\0", ret + 1), - "Expected \"name1\\0name2\\0name4\\0\", got \"%s\"\n", buf); + "Expected \"name1\\x00name2\\x00name4\\x00\\x00\", got %s\n", + debugstr_an(buf, (ret + 2 >= MAX_PATH ? MAX_PATH : ret + 1))); /* lpKeyName is empty */ memset(buf, 0xc,sizeof(buf)); @@ -794,8 +797,9 @@ static void test_GetPrivateProfileString(const char *content, const char *descri ok(ret == 14, "Expected 14, got %d\n", ret); len = lstrlenA("section1") + 2 * sizeof(CHAR); todo_wine - ok(!memcmp(buf, "section1\0secti\0\0", ret + 2), - "Expected \"section1\\0secti\\0\\0\", got \"%s\"\n", buf); + ok(!memcmp(buf, "section1\0secti\0", ret + 2), + "Expected \"section1\\x00secti\\x00\\x00\", got %s\n", + debugstr_an(buf, (ret + 2 >= 16 ? 16 : ret + 1))); /* lpKeyName is NULL, not enough room for final key name */ memset(buf, 0xc,sizeof(buf)); @@ -804,8 +808,9 @@ static void test_GetPrivateProfileString(const char *content, const char *descri buf, 16, filename); ok(ret == 14, "Expected 14, got %d\n", ret); todo_wine - ok(!memcmp(buf, "name1\0name2\0na\0\0", ret + 2), - "Expected \"name1\\0name2\\0na\\0\\0\", got \"%s\"\n", buf); + ok(!memcmp(buf, "name1\0name2\0na\0", ret + 2), + "Expected \"name1\\x00name2\\x00na\\x00\\x00\", got %s\n", + debugstr_an(buf, (ret + 2 >= 16 ? 16 : ret + 1))); /* key value has quotation marks which are stripped */ memset(buf, 0xc,sizeof(buf));
participants (1)
-
Alexandre Julliard