Comments (3)
I missed a backslash:
====
//depot/agent/main/ThirdPartySource/gtest/1.1.0/include/gtest/internal/gtest-int
ernal.h#1
-
C:\depot\agent\main\ThirdPartySource\gtest\1.1.0\include\gtest\internal\gtest-in
ternal.h
====
@@ -728,6 +728,10 @@
catch (expected_exception const&) { \
gtest_caught_expected = true; \
} \
+ catch (expected_exception const* expected_exception_const_pointer) { \
+ delete expected_exception_const_pointer; \
+ gtest_caught_expected = true; \
+ } \
catch (...) { \
gtest_msg = "Expected: " #statement " throws an exception of type " \
#expected_exception ".\n Actual: it throws a different " \
This is now correct and compiles.
Original comment by [email protected]
on 7 Oct 2008 at 5:53
from googletest.
Thanks for the report and the patch.
However I'm not sure if the new behavior is more desirable. It assumes the
pointer
was created using new, which may not be true. More importantly, it can be
misleading: when I see EXPECT_THROW(s, E) and the test passes, I may think that
the
code is throwing an E, when it actually throws an E*. I would want to be
notified if
someone accidentally changes 'throw E()' to 'throw new E()' - I would not want
the
test to continue to pass.
The philosophy behind EXPECT_THROW() and friends is that they provide a
convenient
solution for the common case, not necessarily the general case. You can always
write
explicit try-catch if the macros aren't adequate for you.
Original comment by [email protected]
on 8 Oct 2008 at 9:25
- Changed state: WontFix
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from googletest.
The problem is that with the test as it stands, I can't do EXPECT_THROW(s, E*).
I tried.
I'm not convinced, given the prevalence of "throw new E()" in our code (and
much of
it is pre-2004 when I started), that the "common case" is "throw E()". There's
enough
cases of "throw new E()" that try-catch becomes an imposition, not a solution.
I still think that there's a problem here when attempting to add tests to
legacy code
that does this, when going through and changing everything from "throw new E()"
to
"throw E()" isn't the appropriate answer.
Google Code Search suggests that there's ~13k instances of "throw new".
http://www.google.com/codesearch?q=%22throw+new%22+lang%3A%22C%2B%2B%22
Original comment by [email protected]
on 8 Oct 2008 at 9:54
from googletest.
Related Issues (20)
- wcscasecmp is not always available on Linux
- GTEST_AMBIGUOUS_ELSE_BLOCKER_ causes code analysis warning
- GTEST - ASSERT_EQ and EXPECT_EQ compile error HOT 1
- Warnings when building v8's base-unittests target
- Allow GoogleTest to find clone() with PGI compiler HOT 1
- Project home summary says wiki links are on right, but they are on the left
- With 32-bit target, icc generates remarks about cast of void * to 64-bit integer in PrintTo
- [deleted issue]
- Unable to determine if a test should run before calling RUN_ALL_TESTS HOT 2
- My assert is not caught and the test fails HOT 2
- Throwing an exception as default breaks call count expectation HOT 3
- I put my tests in a library and Google Test doesn't run them - GCC 4.8 HOT 3
- Unknown option specified: gtest_output
- error:SEH exception with code 0xc0000005 thrown in auxiliary test code<environment or event listeners>
- Compilation errors on MinGW
- Duplicate Symbols adding Samples (Xcode)
- PATCH: Fix ‘make check’ in separate build directory
- SEGV on 4 or more test cases with Address Sanitizer HOT 5
- Add the ability to specify parameterized test names
- moving to GITHUB ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googletest.