tr00per / googletest

Automatically exported from code.google.com/p/googletest
0 stars 0 forks source link

Add EXPECT_HRESULT(hr) for Windows systems #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to have a EXPECT_HRESULT(hr) macro to check for S_FALSE on
Win32.

For instance sometimes its not enough to check for
{EXPECT|ASSERT}_HRESULT_SUCCESS when the method returns either S_OK or S_FALSE.

So a generic macro for {EXPECT|ASSERT}_HRESULT would be much appreciated. I
tried myself to implement it. Please see the attached file.

Original issue reported on code.google.com by phil.kur...@gmail.com on 30 Oct 2008 at 11:09

GoogleCodeExporter commented 9 years ago
Forgot to attach the file ;)

Original comment by phil.kur...@gmail.com on 30 Oct 2008 at 11:09

Attachments:

GoogleCodeExporter commented 9 years ago
I just see that I forgot to adjust the WINCE code path.
There should be a 
const char expected_text[] = "";
added afterline 13.

Also the name error_text should be changed to actual_text for consistency.

Original comment by phil.kur...@gmail.com on 30 Oct 2008 at 11:11

GoogleCodeExporter commented 9 years ago
Thanks for contributing, Phil!

Please take a look at the contributor's guide: 
http://code.google.com/p/googletest/wiki/GoogleTestDevGuide

In particular, note that:

- we use http://codereview.appspot.com/ for reviewing patches, and
- you need to sign a CLA in order for us to be able to accept your patch.

We should discuss this on the mailing list first.  I'll start a thread there.  
Thanks.

Original comment by shiq...@gmail.com on 31 Oct 2008 at 6:30

GoogleCodeExporter commented 9 years ago
Closed as won't fix, as this macro doesn't add much value (there are 
alternative ways
to achieve the same effect without introducing a macro).

Original comment by shiq...@gmail.com on 5 Nov 2008 at 9:12

GoogleCodeExporter commented 9 years ago
Sure there are alternative ways, like EXPECT_EQUAL() but it will not nicely 
convert
the unreadable COM HRESULT into plain text. I am using the new macros in my 
tests,
and maybe someone else finds them useful, even when they are not part of the 
standard
googletest distribution.

Original comment by phil.kur...@gmail.com on 6 Nov 2008 at 9:42