[PATCH 2/2] winspool/tests: Test for LastError also on success of AddMonitor

Huw Davies huw at codeweavers.com
Tue Jan 31 04:56:01 CST 2017


On Mon, Jan 30, 2017 at 07:43:35PM +0100, Detlef Riekenberg wrote:
>  dlls/winspool.drv/tests/info.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
> index f6527c5..602e935 100644
> --- a/dlls/winspool.drv/tests/info.c
> +++ b/dlls/winspool.drv/tests/info.c
> @@ -435,6 +435,12 @@ static void test_AddMonitor(void)
>      SetLastError(MAGIC_DEAD);
>      res = AddMonitorA(NULL, 2, (LPBYTE) &mi2a);
>      ok(res, "returned %d with %d (expected '!= 0')\n", res, GetLastError());
> +    if (res)
> +    {
> +        /* Some apps depend on the result of GetLastError() */
> +        res = GetLastError();
> +        ok(res == ERROR_SUCCESS, "got 0x%x/%u (expected ERROR_SUCCESS)\n", res, res);
> +    }

There's no need to have this test conditional on res.
Also, don't reassign res to the error, just use GetLastError() directly.
And just print the error in decimal.

Huw.



More information about the wine-devel mailing list