Francois Gouget : infosoft/tests: Improve the failure messages.

Alexandre Julliard julliard at winehq.org
Mon May 10 15:44:05 CDT 2021


Module: wine
Branch: master
Commit: b2985803c28387a383b7afe3769cb0367e0f09da
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b2985803c28387a383b7afe3769cb0367e0f09da

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon May 10 15:53:57 2021 +0200

infosoft/tests: Improve the failure messages.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/infosoft/tests/infosoft.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c
index 9ea79008364..d221cee5732 100644
--- a/dlls/infosoft/tests/infosoft.c
+++ b/dlls/infosoft/tests/infosoft.c
@@ -71,17 +71,26 @@ static HRESULT WINAPI ws_PutWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcIn
                                  ULONG cwcSrcLen, ULONG cwcSrcPos)
 {
     HRESULT rc = S_OK;
+
+    winetest_push_context("word %d", wordnum);
     if (wordnum < ARRAY_SIZE(testres))
     {
-        ok(testres[wordnum].len == cwcSrcLen, "wrong length\n");
-        ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n");
-        ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n");
+        ok(testres[wordnum].len == cwcSrcLen, "expected length %d, got %d\n",
+           testres[wordnum].len, cwcSrcLen);
+        ok(!cwcSrcPos || (testres[wordnum].ofs == cwcSrcPos),
+           "expected offset %d, got %d\n", testres[wordnum].ofs, cwcSrcPos);
+        ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen),
+           "expected data %s, got %s\n",
+           wine_dbgstr_wn(testres[wordnum].data, cwcSrcLen),
+           wine_dbgstr_wn(pwcInBuf, cwcSrcLen));
     }
     else
     {
         ok(0, "found too many words: %d\n", wordnum + 1);
         rc = E_FAIL;
     }
+    winetest_pop_context();
+
     wordnum++;
     return rc;
 }
@@ -166,7 +175,7 @@ START_TEST(infosoft)
     TEXT_SOURCE ts;
 
     r = CoInitialize(NULL);
-    ok( r == S_OK, "failed\n");
+    ok( r == S_OK, "failed: %08x\n", r);
 
     r = CoCreateInstance( &CLSID_wb_neutral, NULL, CLSCTX_INPROC_SERVER,
                         &_IID_IWordBreaker, (LPVOID)&wb);
@@ -184,9 +193,9 @@ START_TEST(infosoft)
     ts.iEnd = lstrlenW(ts.awcBuffer);
     ts.iCur = 0;
     r = IWordBreaker_BreakText(wb, &ts, &wordsink.IWordSink_iface, NULL);
-    ok( r == S_OK, "failed\n");
+    ok( r == S_OK, "failed: %08x\n", r);
 
-    ok(wordnum == 4, "words not processed\n");
+    ok(wordnum == 4, "expected 4 words, got %d\n", wordnum);
 
     wordnum = 0;
     ts.pfnFillTextBuffer = fillbuf_many;
@@ -195,12 +204,12 @@ START_TEST(infosoft)
     ts.iCur = 0;
 
     r = fillbuf_many(&ts);
-    ok( r == S_OK, "failed\n");
+    ok( r == S_OK, "failed: %08x\n", r);
 
     r = IWordBreaker_BreakText(wb, &ts, &wordsink.IWordSink_iface, NULL);
-    ok( r == S_OK, "failed\n");
+    ok( r == S_OK, "failed: %08x\n", r);
 
-    ok(wordnum == 4, "words not processed\n");
+    ok(wordnum == 4, "expected 4 words, got %d\n", wordnum);
     IWordBreaker_Release( wb );
 
     CoUninitialize();




More information about the wine-cvs mailing list