xinguai / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

need to fail when no test is defined #144

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Sometimes a user links gtest_main.cc with the wrong files and no test is
defined.  The test programs will pass in this case since there's no
assertion failure.

Having no test defined most likely is a user error.  JUnit has been
reporting it as a failure for years, and the users like this.  We should do
the same.

Original issue reported on code.google.com by zhanyong...@gmail.com on 4 May 2009 at 5:50

GoogleCodeExporter commented 9 years ago

Original comment by zhanyong...@gmail.com on 11 Jun 2009 at 3:41

GoogleCodeExporter commented 9 years ago
HI, I will submit a patch for this issue.

Original comment by xueyunlong@gmail.com on 3 Nov 2009 at 1:36

GoogleCodeExporter commented 9 years ago

Original comment by w...@google.com on 27 Sep 2010 at 10:04

GoogleCodeExporter commented 9 years ago
I have created a small patch for this: http://codereview.appspot.com/4634105

It checks if tests are available and fails if no tests are defined.

Remarks:
- The existing test case gtest_no_test_unittest is renamed to 
gtest_expects_before_tests_unittest because we now have test cases without 
defined tests, one with an early EXPECT and one without (the new one).
- It also checks for Passed() so that users get the same behavior with early 
failed EXPECTs as before.

Original comment by dirk....@gmail.com on 28 Jun 2011 at 6:47