[v5 01/12] reg.exe: Fix wrong error message in reg add DWORD test

Stefan Dösinger stefandoesinger at gmail.com
Mon Oct 20 09:56:40 CDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 2014-10-17 20:38, schrieb Jonathan Vollebregt:
>      run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r);
>      todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
> -       "got exit code %d, expected 0\n", r);
> +       "got exit code %d, expected 1\n", r);

r is a DWORD, which is an unsigned value, so %u is the correct format to print it.

There's not much point in printing the expected value. One can look it up by looking at the source file. Having the expected value twice only asks for inconsistencies like the one you're fixing here.

If you want to print the expected value I'd prefer something like this:

todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);

or maybe

todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %d, expected REG_EXIT_SUCCESS(%d)\n", r, REG_EXIT_SUCCESS);

That way you don't hardcode the numerical value of REG_EXIT_SUCCESS.

I recommend sending smaller patchsets, e.g. in your case send the tests, and once they are in, send the implementation changes. The tests make sense on their own, and that way you don't flood wine-patches too much.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJURSKoAAoJEN0/YqbEcdMwgVsP/0rEoBVYlB3zoP979b5q4Wbw
U0Y+ilARyJ4vAoeVKlJtQ8xLxg2Mej6vYvCx5fve6cq6pokUbfrHBpEgBNsjx7gq
AI88t8CSDYnpFBGpDYRVDdwq5enLP0cJKOZHb7pVIR5+1JIbDW/RxA3eLGmbvLsE
EU8nGiSEzYuRwKMy4XfuMFCG1oPRIzg2WO+8ckneJ+P2ZYDmNVWv1sxcuitAm7Lr
g6pq5CwN1Y1agzPHd45W10/hPTnD9ViqaSQgHIpXs47urElL6z1nRb3bgwKAVeBf
9KA9qm12F+zqNoEc9cTHPdnjjOHM7LgQFTmWJDNdZSiXDKMvqZAldRkuI2cAp4jX
tRFYSeUlNk3KDLnJ5msINwRklatovSBbUizHY/D+YhCJVU1aRIKsebJ0zOFrVoUp
2UBbtfBembEOr917aXngNlpZzKPbwPGpm+wyBum7q8OU19CN5X8/WqXZVhms3QAU
bchyP9EnX6SjnHiZn4XE0gC8ABj5LeS24/Zgtfm/T19FT7NL00U49pis+F8RMim8
kthoNp2YO+rpzcvQjaWvBMQlCtecpZx2f9b9x/lfAxd+fMVDGjsVxFcp5V7OipJG
1pdISvYtwOqrlgqiy1Bm4q9vX47y+qDmM1NnAvfBcDkkE/hk+QaCQo+MjAW1W/Bm
7DS30tdCw2E6+XWdk/Du
=Xz8b
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list