Re: [v6] shell32: fix two bugs in IQueryAssocations
Theodore Dubois <tblodt(a)icloud.com> writes:
+ + /* This macro is necessary because of what the ok macro expands to. Failures would report the wrong line number. */ +#define TEST_GET_STRING(a,p,s,es) \ + getstring_test_result = getstring_test(a,p,s,es);\ + ok(getstring_test_result, "\n");
It would be better to avoid the macro and write the tests explicitly, with meaningful error messages. Also, any chance to split the patch? -- Alexandre Julliard julliard(a)winehq.org
The reason I need the macro is: If I wrote ok(getstring_test(whatever)), first the ok macro would call winetest_set_location with the current line number, and then it would call getstring_test. The ok macros in getstring_test would call winetest_set_location and overwrite the location of the actual test. Then if getstring_test returns with a failure, the error message has the wrong line number. The only way to fix this is to call getstring_test on one line and call ok on the next line. I could expand the macro inline, but that would add extra confusing lines of code. Or I could stop using getstring_test, but that would add even more extra confusing lines of code. Or I could leave it alone. What should I do? And next time I send it, I’ll split it into 2 patches. Thank you for reviewing my patch. ~Theodore
On Mar 15, 2016, at 5:25 AM, Alexandre Julliard <julliard(a)winehq.org> wrote:
Theodore Dubois <tblodt(a)icloud.com> writes:
+ + /* This macro is necessary because of what the ok macro expands to. Failures would report the wrong line number. */ +#define TEST_GET_STRING(a,p,s,es) \ + getstring_test_result = getstring_test(a,p,s,es);\ + ok(getstring_test_result, "\n");
It would be better to avoid the macro and write the tests explicitly, with meaningful error messages.
Also, any chance to split the patch?
-- Alexandre Julliard julliard(a)winehq.org
Theodore Dubois <tblodt(a)icloud.com> writes:
The reason I need the macro is: If I wrote ok(getstring_test(whatever)), first the ok macro would call winetest_set_location with the current line number, and then it would call getstring_test. The ok macros in getstring_test would call winetest_set_location and overwrite the location of the actual test. Then if getstring_test returns with a failure, the error message has the wrong line number. The only way to fix this is to call getstring_test on one line and call ok on the next line.
There's no reason to call ok on the getstring_test result, since getstring_test would have already reported the error. If you want to know which caller triggered it, you can pass a line number or some string description to getstring_test. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Theodore Dubois