Unverified Commit 1246e580 authored by Gennadiy Civil's avatar Gennadiy Civil Committed by GitHub
Browse files

Merge branch 'master' into cleanup-cmake

parents 4b6a7a49 2172c08c
...@@ -25,17 +25,17 @@ ...@@ -25,17 +25,17 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Author: vladl@google.com (Vlad Losev) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This file verifies Google Test event listeners receive events at the // This file verifies Google Test event listeners receive events at the
// right times. // right times.
#include "gtest/gtest.h"
#include <vector> #include <vector>
#include "gtest/gtest.h"
using ::testing::AddGlobalTestEnvironment; using ::testing::AddGlobalTestEnvironment;
using ::testing::Environment; using ::testing::Environment;
using ::testing::InitGoogleTest; using ::testing::InitGoogleTest;
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// //
// Tests for the Message class. // Tests for the Message class.
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
//
// Google Test UnitTestOptions tests // Google Test UnitTestOptions tests
// //
// This file tests classes and functions used internally by // This file tests classes and functions used internally by
...@@ -99,15 +98,16 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { ...@@ -99,15 +98,16 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
const std::string exe_str = GetCurrentExecutableName().string(); const std::string exe_str = GetCurrentExecutableName().string();
#if GTEST_OS_WINDOWS #if GTEST_OS_WINDOWS
const bool success = const bool success =
_strcmpi("gtest-options_test", exe_str.c_str()) == 0 || _strcmpi("googletest-options-test", exe_str.c_str()) == 0 ||
_strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 || _strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 ||
_strcmpi("gtest_all_test", exe_str.c_str()) == 0 || _strcmpi("gtest_all_test", exe_str.c_str()) == 0 ||
_strcmpi("gtest_dll_test", exe_str.c_str()) == 0; _strcmpi("gtest_dll_test", exe_str.c_str()) == 0;
#elif GTEST_OS_FUCHSIA
const bool success = exe_str == "app";
#else #else
// TODO(wan@google.com): remove the hard-coded "lt-" prefix when // FIXME: remove the hard-coded "lt-" prefix when libtool replacement is ready
// Chandler Carruth's libtool replacement is ready.
const bool success = const bool success =
exe_str == "gtest-options_test" || exe_str == "googletest-options-test" ||
exe_str == "gtest_all_test" || exe_str == "gtest_all_test" ||
exe_str == "lt-gtest_all_test" || exe_str == "lt-gtest_all_test" ||
exe_str == "gtest_dll_test"; exe_str == "gtest_dll_test";
...@@ -116,6 +116,8 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { ...@@ -116,6 +116,8 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
FAIL() << "GetCurrentExecutableName() returns " << exe_str; FAIL() << "GetCurrentExecutableName() returns " << exe_str;
} }
#if !GTEST_OS_FUCHSIA
class XmlOutputChangeDirTest : public Test { class XmlOutputChangeDirTest : public Test {
protected: protected:
virtual void SetUp() { virtual void SetUp() {
...@@ -202,6 +204,8 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) { ...@@ -202,6 +204,8 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
#endif #endif
} }
#endif // !GTEST_OS_FUCHSIA
} // namespace } // namespace
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
The non-test part of the code is expected to have 2 failures. The non-test part of the code is expected to have 2 failures.
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Value of: false Value of: false
Actual: false Actual: false
Expected: true Expected: true
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
2 2
3 3
Stack trace: (omitted)
[==========] Running 68 tests from 30 test cases. [==========] Running 68 tests from 30 test cases.
[----------] Global test environment set-up. [----------] Global test environment set-up.
FooEnvironment::SetUp() called. FooEnvironment::SetUp() called.
...@@ -34,21 +38,25 @@ BarEnvironment::SetUp() called. ...@@ -34,21 +38,25 @@ BarEnvironment::SetUp() called.
[ OK ] PassingTest.PassingTest2 [ OK ] PassingTest.PassingTest2
[----------] 2 tests from NonfatalFailureTest [----------] 2 tests from NonfatalFailureTest
[ RUN ] NonfatalFailureTest.EscapesStringOperands [ RUN ] NonfatalFailureTest.EscapesStringOperands
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
kGoldenString kGoldenString
Which is: "\"Line" Which is: "\"Line"
actual actual
Which is: "actual \"string\"" Which is: "actual \"string\""
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
golden golden
Which is: "\"Line" Which is: "\"Line"
actual actual
Which is: "actual \"string\"" Which is: "actual \"string\""
Stack trace: (omitted)
[ FAILED ] NonfatalFailureTest.EscapesStringOperands [ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ RUN ] NonfatalFailureTest.DiffForLongStrings [ RUN ] NonfatalFailureTest.DiffForLongStrings
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
golden_str golden_str
Which is: "\"Line\0 1\"\nLine 2" Which is: "\"Line\0 1\"\nLine 2"
...@@ -58,241 +66,323 @@ With diff: ...@@ -58,241 +66,323 @@ With diff:
-\"Line\0 1\" -\"Line\0 1\"
Line 2 Line 2
Stack trace: (omitted)
[ FAILED ] NonfatalFailureTest.DiffForLongStrings [ FAILED ] NonfatalFailureTest.DiffForLongStrings
[----------] 3 tests from FatalFailureTest [----------] 3 tests from FatalFailureTest
[ RUN ] FatalFailureTest.FatalFailureInSubroutine [ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
x x
Which is: 2 Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine [ FAILED ] FatalFailureTest.FatalFailureInSubroutine
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
x x
Which is: 2 Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false) (expecting a failure on false)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Value of: false Value of: false
Actual: false Actual: false
Expected: true Expected: true
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine [ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine
[----------] 1 test from LoggingTest [----------] 1 test from LoggingTest
[ RUN ] LoggingTest.InterleavingLoggingAndAssertions [ RUN ] LoggingTest.InterleavingLoggingAndAssertions
(expecting 2 failures on (3) >= (a[i])) (expecting 2 failures on (3) >= (a[i]))
i == 0 i == 0
i == 1 i == 1
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 9 Expected: (3) >= (a[i]), actual: 3 vs 9
Stack trace: (omitted)
i == 2 i == 2
i == 3 i == 3
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6 Expected: (3) >= (a[i]), actual: 3 vs 6
Stack trace: (omitted)
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions [ FAILED ] LoggingTest.InterleavingLoggingAndAssertions
[----------] 7 tests from SCOPED_TRACETest [----------] 7 tests from SCOPED_TRACETest
[ RUN ] SCOPED_TRACETest.AcceptedValues [ RUN ] SCOPED_TRACETest.AcceptedValues
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Just checking that all these values work fine. Just checking that all these values work fine.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: (null) googletest-output-test_.cc:#: (null)
gtest_output_test_.cc:#: 1337 googletest-output-test_.cc:#: 1337
gtest_output_test_.cc:#: std::string googletest-output-test_.cc:#: std::string
gtest_output_test_.cc:#: literal string googletest-output-test_.cc:#: literal string
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.AcceptedValues [ FAILED ] SCOPED_TRACETest.AcceptedValues
[ RUN ] SCOPED_TRACETest.ObeysScopes [ RUN ] SCOPED_TRACETest.ObeysScopes
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and shouldn't have a trace. This failure is expected, and shouldn't have a trace.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and should have a trace. This failure is expected, and should have a trace.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: Expected trace googletest-output-test_.cc:#: Expected trace
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and shouldn't have a trace. This failure is expected, and shouldn't have a trace.
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.ObeysScopes [ FAILED ] SCOPED_TRACETest.ObeysScopes
[ RUN ] SCOPED_TRACETest.WorksInLoop [ RUN ] SCOPED_TRACETest.WorksInLoop
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
2 2
n n
Which is: 1 Which is: 1
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: i = 1 googletest-output-test_.cc:#: i = 1
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
n n
Which is: 2 Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: i = 2 googletest-output-test_.cc:#: i = 2
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.WorksInLoop [ FAILED ] SCOPED_TRACETest.WorksInLoop
[ RUN ] SCOPED_TRACETest.WorksInSubroutine [ RUN ] SCOPED_TRACETest.WorksInSubroutine
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
2 2
n n
Which is: 1 Which is: 1
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 1 googletest-output-test_.cc:#: n = 1
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
n n
Which is: 2 Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 2 googletest-output-test_.cc:#: n = 2
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.WorksInSubroutine [ FAILED ] SCOPED_TRACETest.WorksInSubroutine
[ RUN ] SCOPED_TRACETest.CanBeNested [ RUN ] SCOPED_TRACETest.CanBeNested
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
n n
Which is: 2 Which is: 2
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: n = 2 googletest-output-test_.cc:#: n = 2
gtest_output_test_.cc:#: googletest-output-test_.cc:#:
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.CanBeNested [ FAILED ] SCOPED_TRACETest.CanBeNested
[ RUN ] SCOPED_TRACETest.CanBeRepeated [ RUN ] SCOPED_TRACETest.CanBeRepeated
(expected to fail) (expected to fail)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and should contain trace point A. This failure is expected, and should contain trace point A.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: A googletest-output-test_.cc:#: A
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and should contain trace point A and B. This failure is expected, and should contain trace point A and B.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: B googletest-output-test_.cc:#: B
gtest_output_test_.cc:#: A googletest-output-test_.cc:#: A
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and should contain trace point A, B, and C. This failure is expected, and should contain trace point A, B, and C.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: C googletest-output-test_.cc:#: C
gtest_output_test_.cc:#: B googletest-output-test_.cc:#: B
gtest_output_test_.cc:#: A googletest-output-test_.cc:#: A
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
This failure is expected, and should contain trace point A, B, and D. This failure is expected, and should contain trace point A, B, and D.
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: D googletest-output-test_.cc:#: D
gtest_output_test_.cc:#: B googletest-output-test_.cc:#: B
gtest_output_test_.cc:#: A googletest-output-test_.cc:#: A
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.CanBeRepeated [ FAILED ] SCOPED_TRACETest.CanBeRepeated
[ RUN ] SCOPED_TRACETest.WorksConcurrently [ RUN ] SCOPED_TRACETest.WorksConcurrently
(expecting 6 failures) (expecting 6 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #1 (in thread B, only trace B alive). Expected failure #1 (in thread B, only trace B alive).
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: Trace B googletest-output-test_.cc:#: Trace B
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #2 (in thread A, trace A & B both alive). Expected failure #2 (in thread A, trace A & B both alive).
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: Trace A googletest-output-test_.cc:#: Trace A
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #3 (in thread B, trace A & B both alive). Expected failure #3 (in thread B, trace A & B both alive).
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: Trace B googletest-output-test_.cc:#: Trace B
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #4 (in thread B, only trace A alive). Expected failure #4 (in thread B, only trace A alive).
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #5 (in thread A, only trace A alive). Expected failure #5 (in thread A, only trace A alive).
Google Test trace: Google Test trace:
gtest_output_test_.cc:#: Trace A googletest-output-test_.cc:#: Trace A
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #6 (in thread A, no trace alive). Expected failure #6 (in thread A, no trace alive).
Stack trace: (omitted)
[ FAILED ] SCOPED_TRACETest.WorksConcurrently [ FAILED ] SCOPED_TRACETest.WorksConcurrently
[----------] 1 test from ScopedTraceTest [----------] 1 test from ScopedTraceTest
[ RUN ] ScopedTraceTest.WithExplicitFileAndLine [ RUN ] ScopedTraceTest.WithExplicitFileAndLine
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Check that the trace is attached to a particular location. Check that the trace is attached to a particular location.
Google Test trace: Google Test trace:
explicit_file.cc:123: expected trace message explicit_file.cc:123: expected trace message
Stack trace: (omitted)
[ FAILED ] ScopedTraceTest.WithExplicitFileAndLine [ FAILED ] ScopedTraceTest.WithExplicitFileAndLine
[----------] 1 test from NonFatalFailureInFixtureConstructorTest [----------] 1 test from NonFatalFailureInFixtureConstructorTest
[ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor [ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 5 failures) (expecting 5 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #1, in the test fixture c'tor. Expected failure #1, in the test fixture c'tor.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #2, in SetUp(). Expected failure #2, in SetUp().
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #3, in the test body. Expected failure #3, in the test body.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #4, in TearDown. Expected failure #4, in TearDown.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #5, in the test fixture d'tor. Expected failure #5, in the test fixture d'tor.
Stack trace: (omitted)
[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor [ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
[----------] 1 test from FatalFailureInFixtureConstructorTest [----------] 1 test from FatalFailureInFixtureConstructorTest
[ RUN ] FatalFailureInFixtureConstructorTest.FailureInConstructor [ RUN ] FatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 2 failures) (expecting 2 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #1, in the test fixture c'tor. Expected failure #1, in the test fixture c'tor.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #2, in the test fixture d'tor. Expected failure #2, in the test fixture d'tor.
Stack trace: (omitted)
[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor [ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
[----------] 1 test from NonFatalFailureInSetUpTest [----------] 1 test from NonFatalFailureInSetUpTest
[ RUN ] NonFatalFailureInSetUpTest.FailureInSetUp [ RUN ] NonFatalFailureInSetUpTest.FailureInSetUp
(expecting 4 failures) (expecting 4 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #1, in SetUp(). Expected failure #1, in SetUp().
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #2, in the test function. Expected failure #2, in the test function.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #3, in TearDown(). Expected failure #3, in TearDown().
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #4, in the test fixture d'tor. Expected failure #4, in the test fixture d'tor.
Stack trace: (omitted)
[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp [ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
[----------] 1 test from FatalFailureInSetUpTest [----------] 1 test from FatalFailureInSetUpTest
[ RUN ] FatalFailureInSetUpTest.FailureInSetUp [ RUN ] FatalFailureInSetUpTest.FailureInSetUp
(expecting 3 failures) (expecting 3 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #1, in SetUp(). Expected failure #1, in SetUp().
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #2, in TearDown(). Expected failure #2, in TearDown().
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected failure #3, in the test fixture d'tor. Expected failure #3, in the test fixture d'tor.
Stack trace: (omitted)
[ FAILED ] FatalFailureInSetUpTest.FailureInSetUp [ FAILED ] FatalFailureInSetUpTest.FailureInSetUp
[----------] 1 test from AddFailureAtTest [----------] 1 test from AddFailureAtTest
[ RUN ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber [ RUN ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
foo.cc:42: Failure foo.cc:42: Failure
Failed Failed
Expected failure in foo.cc Expected failure in foo.cc
Stack trace: (omitted)
[ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber [ FAILED ] AddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
[----------] 4 tests from MixedUpTestCaseTest [----------] 4 tests from MixedUpTestCaseTest
[ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo [ RUN ] MixedUpTestCaseTest.FirstTestFromNamespaceFoo
...@@ -309,6 +399,8 @@ using two different test fixture classes. This can happen if ...@@ -309,6 +399,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation the two classes are from different namespaces or translation
units and have the same name. You should probably rename one units and have the same name. You should probably rename one
of the classes to put the tests into different test cases. of the classes to put the tests into different test cases.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseTest.ThisShouldFail [ FAILED ] MixedUpTestCaseTest.ThisShouldFail
[ RUN ] MixedUpTestCaseTest.ThisShouldFailToo [ RUN ] MixedUpTestCaseTest.ThisShouldFailToo
gtest.cc:#: Failure gtest.cc:#: Failure
...@@ -320,6 +412,8 @@ using two different test fixture classes. This can happen if ...@@ -320,6 +412,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation the two classes are from different namespaces or translation
units and have the same name. You should probably rename one units and have the same name. You should probably rename one
of the classes to put the tests into different test cases. of the classes to put the tests into different test cases.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo [ FAILED ] MixedUpTestCaseTest.ThisShouldFailToo
[----------] 2 tests from MixedUpTestCaseWithSameTestNameTest [----------] 2 tests from MixedUpTestCaseWithSameTestNameTest
[ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail [ RUN ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
...@@ -334,6 +428,8 @@ using two different test fixture classes. This can happen if ...@@ -334,6 +428,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation the two classes are from different namespaces or translation
units and have the same name. You should probably rename one units and have the same name. You should probably rename one
of the classes to put the tests into different test cases. of the classes to put the tests into different test cases.
Stack trace: (omitted)
[ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail [ FAILED ] MixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[----------] 2 tests from TEST_F_before_TEST_in_same_test_case [----------] 2 tests from TEST_F_before_TEST_in_same_test_case
[ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F [ RUN ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
...@@ -348,6 +444,8 @@ test DefinedUsingTEST_F is defined using TEST_F but ...@@ -348,6 +444,8 @@ test DefinedUsingTEST_F is defined using TEST_F but
test DefinedUsingTESTAndShouldFail is defined using TEST. You probably test DefinedUsingTESTAndShouldFail is defined using TEST. You probably
want to change the TEST to TEST_F or move it to another test want to change the TEST to TEST_F or move it to another test
case. case.
Stack trace: (omitted)
[ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail [ FAILED ] TEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
[----------] 2 tests from TEST_before_TEST_F_in_same_test_case [----------] 2 tests from TEST_before_TEST_F_in_same_test_case
[ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST [ RUN ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
...@@ -362,6 +460,8 @@ test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but ...@@ -362,6 +460,8 @@ test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but
test DefinedUsingTEST is defined using TEST. You probably test DefinedUsingTEST is defined using TEST. You probably
want to change the TEST to TEST_F or move it to another test want to change the TEST to TEST_F or move it to another test
case. case.
Stack trace: (omitted)
[ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail [ FAILED ] TEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
[----------] 8 tests from ExpectNonfatalFailureTest [----------] 8 tests from ExpectNonfatalFailureTest
[ RUN ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables [ RUN ] ExpectNonfatalFailureTest.CanReferenceGlobalVariables
...@@ -375,19 +475,27 @@ case. ...@@ -375,19 +475,27 @@ case.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure [ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures [ RUN ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
(expecting a failure) (expecting a failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: 2 failures Actual: 2 failures
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure 1. Expected non-fatal failure 1.
Stack trace: (omitted)
gtest_output_test_.cc:#: Non-fatal failure:
googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure 2. Expected non-fatal failure 2.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures [ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
[ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure [ RUN ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
...@@ -395,9 +503,13 @@ Expected non-fatal failure 2. ...@@ -395,9 +503,13 @@ Expected non-fatal failure 2.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure [ FAILED ] ExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementReturns [ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
...@@ -405,12 +517,16 @@ Expected fatal failure. ...@@ -405,12 +517,16 @@ Expected fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns [ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementReturns
[ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementThrows [ RUN ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
(expecting a failure) (expecting a failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows [ FAILED ] ExpectNonfatalFailureTest.FailsWhenStatementThrows
[----------] 8 tests from ExpectFatalFailureTest [----------] 8 tests from ExpectFatalFailureTest
[ RUN ] ExpectFatalFailureTest.CanReferenceGlobalVariables [ RUN ] ExpectFatalFailureTest.CanReferenceGlobalVariables
...@@ -424,19 +540,27 @@ Expected: 1 non-fatal failure ...@@ -424,19 +540,27 @@ Expected: 1 non-fatal failure
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure [ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
[ RUN ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures [ RUN ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
(expecting a failure) (expecting a failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: 2 failures Actual: 2 failures
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures [ FAILED ] ExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
[ RUN ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure [ RUN ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
...@@ -444,9 +568,13 @@ Expected fatal failure. ...@@ -444,9 +568,13 @@ Expected fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure [ FAILED ] ExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
[ RUN ] ExpectFatalFailureTest.FailsWhenStatementReturns [ RUN ] ExpectFatalFailureTest.FailsWhenStatementReturns
...@@ -454,72 +582,94 @@ Expected non-fatal failure. ...@@ -454,72 +582,94 @@ Expected non-fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns [ FAILED ] ExpectFatalFailureTest.FailsWhenStatementReturns
[ RUN ] ExpectFatalFailureTest.FailsWhenStatementThrows [ RUN ] ExpectFatalFailureTest.FailsWhenStatementThrows
(expecting a failure) (expecting a failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows [ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
[----------] 2 tests from TypedTest/0, where TypeParam = int [----------] 2 tests from TypedTest/0, where TypeParam = int
[ RUN ] TypedTest/0.Success [ RUN ] TypedTest/0.Success
[ OK ] TypedTest/0.Success [ OK ] TypedTest/0.Success
[ RUN ] TypedTest/0.Failure [ RUN ] TypedTest/0.Failure
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
TypeParam() TypeParam()
Which is: 0 Which is: 0
Expected failure Expected failure
Stack trace: (omitted)
[ FAILED ] TypedTest/0.Failure, where TypeParam = int [ FAILED ] TypedTest/0.Failure, where TypeParam = int
[----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char [----------] 2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
[ RUN ] Unsigned/TypedTestP/0.Success [ RUN ] Unsigned/TypedTestP/0.Success
[ OK ] Unsigned/TypedTestP/0.Success [ OK ] Unsigned/TypedTestP/0.Success
[ RUN ] Unsigned/TypedTestP/0.Failure [ RUN ] Unsigned/TypedTestP/0.Failure
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1U 1U
Which is: 1 Which is: 1
TypeParam() TypeParam()
Which is: '\0' Which is: '\0'
Expected failure Expected failure
Stack trace: (omitted)
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char [ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned [----------] 2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned int
[ RUN ] Unsigned/TypedTestP/1.Success [ RUN ] Unsigned/TypedTestP/1.Success
[ OK ] Unsigned/TypedTestP/1.Success [ OK ] Unsigned/TypedTestP/1.Success
[ RUN ] Unsigned/TypedTestP/1.Failure [ RUN ] Unsigned/TypedTestP/1.Failure
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1U 1U
Which is: 1 Which is: 1
TypeParam() TypeParam()
Which is: 0 Which is: 0
Expected failure Expected failure
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned Stack trace: (omitted)
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[----------] 4 tests from ExpectFailureTest [----------] 4 tests from ExpectFailureTest
[ RUN ] ExpectFailureTest.ExpectFatalFailure [ RUN ] ExpectFailureTest.ExpectFatalFailure
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Success: googletest-output-test_.cc:#: Success:
Succeeded Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected." Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual: Actual:
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFailureTest.ExpectFatalFailure [ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ RUN ] ExpectFailureTest.ExpectNonFatalFailure [ RUN ] ExpectFailureTest.ExpectNonFatalFailure
...@@ -527,24 +677,36 @@ Expected fatal failure. ...@@ -527,24 +677,36 @@ Expected fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Success: googletest-output-test_.cc:#: Success:
Succeeded Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure." Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual: Actual:
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure [ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads [ RUN ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
...@@ -552,24 +714,36 @@ Expected non-fatal failure. ...@@ -552,24 +714,36 @@ Expected non-fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Success: googletest-output-test_.cc:#: Success:
Succeeded Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected." Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual: Actual:
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads [ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
[ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads [ RUN ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
...@@ -577,83 +751,115 @@ Expected fatal failure. ...@@ -577,83 +751,115 @@ Expected fatal failure.
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Success: googletest-output-test_.cc:#: Success:
Succeeded Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: Actual:
gtest_output_test_.cc:#: Fatal failure: googletest-output-test_.cc:#: Fatal failure:
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure) (expecting 1 failure)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure." Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual: Actual:
gtest_output_test_.cc:#: Non-fatal failure: googletest-output-test_.cc:#: Non-fatal failure:
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads [ FAILED ] ExpectFailureTest.ExpectNonFatalFailureOnAllThreads
[----------] 2 tests from ExpectFailureWithThreadsTest [----------] 2 tests from ExpectFailureWithThreadsTest
[ RUN ] ExpectFailureWithThreadsTest.ExpectFatalFailure [ RUN ] ExpectFailureWithThreadsTest.ExpectFatalFailure
(expecting 2 failures) (expecting 2 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 fatal failure Expected: 1 fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectFailureWithThreadsTest.ExpectFatalFailure [ FAILED ] ExpectFailureWithThreadsTest.ExpectFatalFailure
[ RUN ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure [ RUN ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure
(expecting 2 failures) (expecting 2 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
gtest.cc:#: Failure gtest.cc:#: Failure
Expected: 1 non-fatal failure Expected: 1 non-fatal failure
Actual: 0 failures Actual: 0 failures
Stack trace: (omitted)
[ FAILED ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure [ FAILED ] ExpectFailureWithThreadsTest.ExpectNonFatalFailure
[----------] 1 test from ScopedFakeTestPartResultReporterTest [----------] 1 test from ScopedFakeTestPartResultReporterTest
[ RUN ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread [ RUN ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
(expecting 2 failures) (expecting 2 failures)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected fatal failure. Expected fatal failure.
gtest_output_test_.cc:#: Failure Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
[ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread [ FAILED ] ScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
[----------] 1 test from PrintingFailingParams/FailingParamTest [----------] 1 test from PrintingFailingParams/FailingParamTest
[ RUN ] PrintingFailingParams/FailingParamTest.Fails/0 [ RUN ] PrintingFailingParams/FailingParamTest.Fails/0
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
GetParam() GetParam()
Which is: 2 Which is: 2
Stack trace: (omitted)
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2 [ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[----------] 2 tests from PrintingStrings/ParamTest [----------] 2 tests from PrintingStrings/ParamTest
[ RUN ] PrintingStrings/ParamTest.Success/a [ RUN ] PrintingStrings/ParamTest.Success/a
[ OK ] PrintingStrings/ParamTest.Success/a [ OK ] PrintingStrings/ParamTest.Success/a
[ RUN ] PrintingStrings/ParamTest.Failure/a [ RUN ] PrintingStrings/ParamTest.Failure/a
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
"b" "b"
GetParam() GetParam()
Which is: "a" Which is: "a"
Expected failure Expected failure
Stack trace: (omitted)
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a" [ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[----------] Global test environment tear-down [----------] Global test environment tear-down
BarEnvironment::TearDown() called. BarEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected non-fatal failure. Expected non-fatal failure.
Stack trace: (omitted)
FooEnvironment::TearDown() called. FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Failed Failed
Expected fatal failure. Expected fatal failure.
Stack trace: (omitted)
[==========] 68 tests from 30 test cases ran. [==========] 68 tests from 30 test cases ran.
[ PASSED ] 22 tests. [ PASSED ] 22 tests.
[ FAILED ] 46 tests, listed below: [ FAILED ] 46 tests, listed below:
...@@ -693,7 +899,7 @@ Expected fatal failure. ...@@ -693,7 +899,7 @@ Expected fatal failure.
[ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows [ FAILED ] ExpectFatalFailureTest.FailsWhenStatementThrows
[ FAILED ] TypedTest/0.Failure, where TypeParam = int [ FAILED ] TypedTest/0.Failure, where TypeParam = int
[ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char [ FAILED ] Unsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned [ FAILED ] Unsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[ FAILED ] ExpectFailureTest.ExpectFatalFailure [ FAILED ] ExpectFailureTest.ExpectFatalFailure
[ FAILED ] ExpectFailureTest.ExpectNonFatalFailure [ FAILED ] ExpectFailureTest.ExpectNonFatalFailure
[ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads [ FAILED ] ExpectFailureTest.ExpectFatalFailureOnAllThreads
...@@ -713,26 +919,32 @@ Expected fatal failure. ...@@ -713,26 +919,32 @@ Expected fatal failure.
[----------] 3 tests from FatalFailureTest [----------] 3 tests from FatalFailureTest
[ RUN ] FatalFailureTest.FatalFailureInSubroutine [ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
x x
Which is: 2 Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms) [ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1) (expecting a failure that x should be 1)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected equality of these values: Expected equality of these values:
1 1
x x
Which is: 2 Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms) [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false) (expecting a failure on false)
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Value of: false Value of: false
Actual: false Actual: false
Expected: true Expected: true
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine (? ms) [ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)
[----------] 3 tests from FatalFailureTest (? ms total) [----------] 3 tests from FatalFailureTest (? ms total)
...@@ -741,12 +953,16 @@ Expected: true ...@@ -741,12 +953,16 @@ Expected: true
(expecting 2 failures on (3) >= (a[i])) (expecting 2 failures on (3) >= (a[i]))
i == 0 i == 0
i == 1 i == 1
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 9 Expected: (3) >= (a[i]), actual: 3 vs 9
Stack trace: (omitted)
i == 2 i == 2
i == 3 i == 3
gtest_output_test_.cc:#: Failure googletest-output-test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6 Expected: (3) >= (a[i]), actual: 3 vs 6
Stack trace: (omitted)
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions (? ms) [ FAILED ] LoggingTest.InterleavingLoggingAndAssertions (? ms)
[----------] 1 test from LoggingTest (? ms total) [----------] 1 test from LoggingTest (? ms total)
......
...@@ -29,18 +29,15 @@ ...@@ -29,18 +29,15 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests the text output of Google C++ Testing Framework. """Tests the text output of Google C++ Testing and Mocking Framework.
To update the golden file:
SYNOPSIS googletest_output_test.py --build_dir=BUILD/DIR --gengolden
gtest_output_test.py --build_dir=BUILD/DIR --gengolden where BUILD/DIR contains the built googletest-output-test_ file.
# where BUILD/DIR contains the built gtest_output_test_ file. googletest_output_test.py --gengolden
gtest_output_test.py --gengolden googletest_output_test.py
gtest_output_test.py
""" """
__author__ = 'wan@google.com (Zhanyong Wan)'
import difflib import difflib
import os import os
import re import re
...@@ -52,13 +49,16 @@ import gtest_test_utils ...@@ -52,13 +49,16 @@ import gtest_test_utils
GENGOLDEN_FLAG = '--gengolden' GENGOLDEN_FLAG = '--gengolden'
CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS' CATCH_EXCEPTIONS_ENV_VAR_NAME = 'GTEST_CATCH_EXCEPTIONS'
# The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG = '--no_stacktrace_support'
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
IS_WINDOWS = os.name == 'nt' IS_WINDOWS = os.name == 'nt'
# TODO(vladl@google.com): remove the _lin suffix. # FIXME: remove the _lin suffix.
GOLDEN_NAME = 'gtest_output_test_golden_lin.txt' GOLDEN_NAME = 'googletest-output-test-golden-lin.txt'
PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_') PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('googletest-output-test_')
# At least one command we exercise must not have the # At least one command we exercise must not have the
# 'internal_skip_environment_and_ad_hoc_tests' argument. # 'internal_skip_environment_and_ad_hoc_tests' argument.
...@@ -101,7 +101,7 @@ def RemoveLocations(test_output): ...@@ -101,7 +101,7 @@ def RemoveLocations(test_output):
'FILE_NAME:#: '. 'FILE_NAME:#: '.
""" """
return re.sub(r'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: ', return re.sub(r'.*[/\\]((googletest-output-test_|gtest).cc)(\:\d+|\(\d+\))\: ',
r'\1:#: ', test_output) r'\1:#: ', test_output)
...@@ -192,7 +192,7 @@ def RemoveMatchingTests(test_output, pattern): ...@@ -192,7 +192,7 @@ def RemoveMatchingTests(test_output, pattern):
def NormalizeOutput(output): def NormalizeOutput(output):
"""Normalizes output (the output of gtest_output_test_.exe).""" """Normalizes output (the output of googletest-output-test_.exe)."""
output = ToUnixLineEnding(output) output = ToUnixLineEnding(output)
output = RemoveLocations(output) output = RemoveLocations(output)
...@@ -252,13 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS) ...@@ -252,13 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list SUPPORTS_DEATH_TESTS = 'DeathTest' in test_list
SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list SUPPORTS_TYPED_TESTS = 'TypedTest' in test_list
SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list SUPPORTS_THREADS = 'ExpectFailureWithThreadsTest' in test_list
SUPPORTS_STACK_TRACES = IS_LINUX SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv
CAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and CAN_GENERATE_GOLDEN_FILE = (SUPPORTS_DEATH_TESTS and
SUPPORTS_TYPED_TESTS and SUPPORTS_TYPED_TESTS and
SUPPORTS_THREADS and SUPPORTS_THREADS and
SUPPORTS_STACK_TRACES and SUPPORTS_STACK_TRACES)
not IS_WINDOWS)
class GTestOutputTest(gtest_test_utils.TestCase): class GTestOutputTest(gtest_test_utils.TestCase):
def RemoveUnsupportedTests(self, test_output): def RemoveUnsupportedTests(self, test_output):
...@@ -314,18 +313,22 @@ class GTestOutputTest(gtest_test_utils.TestCase): ...@@ -314,18 +313,22 @@ class GTestOutputTest(gtest_test_utils.TestCase):
if os.getenv('DEBUG_GTEST_OUTPUT_TEST'): if os.getenv('DEBUG_GTEST_OUTPUT_TEST'):
open(os.path.join( open(os.path.join(
gtest_test_utils.GetSourceDir(), gtest_test_utils.GetSourceDir(),
'_gtest_output_test_normalized_actual.txt'), 'wb').write( '_googletest-output-test_normalized_actual.txt'), 'wb').write(
normalized_actual) normalized_actual)
open(os.path.join( open(os.path.join(
gtest_test_utils.GetSourceDir(), gtest_test_utils.GetSourceDir(),
'_gtest_output_test_normalized_golden.txt'), 'wb').write( '_googletest-output-test_normalized_golden.txt'), 'wb').write(
normalized_golden) normalized_golden)
self.assertEqual(normalized_golden, normalized_actual) self.assertEqual(normalized_golden, normalized_actual)
if __name__ == '__main__': if __name__ == '__main__':
if sys.argv[1:] == [GENGOLDEN_FLAG]: if NO_STACKTRACE_SUPPORT_FLAG in sys.argv:
# unittest.main() can't handle unknown flags
sys.argv.remove(NO_STACKTRACE_SUPPORT_FLAG)
if GENGOLDEN_FLAG in sys.argv:
if CAN_GENERATE_GOLDEN_FILE: if CAN_GENERATE_GOLDEN_FILE:
output = GetOutputOfAllCommands() output = GetOutputOfAllCommands()
golden_file = open(GOLDEN_PATH, 'wb') golden_file = open(GOLDEN_PATH, 'wb')
......
...@@ -29,11 +29,9 @@ ...@@ -29,11 +29,9 @@
// //
// The purpose of this file is to generate Google Test output under // The purpose of this file is to generate Google Test output under
// various conditions. The output will then be verified by // various conditions. The output will then be verified by
// gtest_output_test.py to ensure that Google Test generates the // googletest-output-test.py to ensure that Google Test generates the
// desired messages. Therefore, most tests in this file are MEANT TO // desired messages. Therefore, most tests in this file are MEANT TO
// FAIL. // FAIL.
//
// Author: wan@google.com (Zhanyong Wan)
#include "gtest/gtest-spi.h" #include "gtest/gtest-spi.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
......
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test warns the user when not initialized properly."""
import gtest_test_utils
binary_name = 'googletest-param-test-invalid-name1-test_'
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
def Assert(condition):
if not condition:
raise AssertionError
def TestExitCodeAndOutput(command):
"""Runs the given command and verifies its exit code and output."""
err = ('Parameterized test name \'"InvalidWithQuotes"\' is invalid')
p = gtest_test_utils.Subprocess(command)
Assert(p.terminated_by_signal)
# Verify the output message contains appropriate output
Assert(err in p.output)
class GTestParamTestInvalidName1Test(gtest_test_utils.TestCase):
def testExitCodeAndOutput(self):
TestExitCodeAndOutput(COMMAND)
if __name__ == '__main__':
gtest_test_utils.Main()
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
namespace {
class DummyTest : public ::testing::TestWithParam<const char *> {};
TEST_P(DummyTest, Dummy) {
}
INSTANTIATE_TEST_CASE_P(InvalidTestName,
DummyTest,
::testing::Values("InvalidWithQuotes"),
::testing::PrintToStringParamName());
} // namespace
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test warns the user when not initialized properly."""
import gtest_test_utils
binary_name = 'googletest-param-test-invalid-name2-test_'
COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
def Assert(condition):
if not condition:
raise AssertionError
def TestExitCodeAndOutput(command):
"""Runs the given command and verifies its exit code and output."""
err = ('Duplicate parameterized test name \'a\'')
p = gtest_test_utils.Subprocess(command)
Assert(p.terminated_by_signal)
# Check for appropriate output
Assert(err in p.output)
class GTestParamTestInvalidName2Test(gtest_test_utils.TestCase):
def testExitCodeAndOutput(self):
TestExitCodeAndOutput(COMMAND)
if __name__ == '__main__':
gtest_test_utils.Main()
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
namespace {
class DummyTest : public ::testing::TestWithParam<const char *> {};
std::string StringParamTestSuffix(
const testing::TestParamInfo<const char*>& info) {
return std::string(info.param);
}
TEST_P(DummyTest, Dummy) {
}
INSTANTIATE_TEST_CASE_P(DuplicateTestNames,
DummyTest,
::testing::Values("a", "b", "a", "c"),
StringParamTestSuffix);
} // namespace
int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// //
// Tests for Google Test itself. This file verifies that the parameter // Tests for Google Test itself. This file verifies that the parameter
// generators objects produce correct parameter sequences and that // generators objects produce correct parameter sequences and that
...@@ -43,7 +42,7 @@ ...@@ -43,7 +42,7 @@
# include <vector> # include <vector>
# include "src/gtest-internal-inl.h" // for UnitTestOptions # include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "test/gtest-param-test_test.h" # include "test/googletest-param-test-test.h"
using ::std::vector; using ::std::vector;
using ::std::sort; using ::std::sort;
...@@ -68,7 +67,7 @@ using ::testing::internal::UnitTestOptions; ...@@ -68,7 +67,7 @@ using ::testing::internal::UnitTestOptions;
// Prints a value to a string. // Prints a value to a string.
// //
// TODO(wan@google.com): remove PrintValue() when we move matchers and // FIXME: remove PrintValue() when we move matchers and
// EXPECT_THAT() from Google Mock to Google Test. At that time, we // EXPECT_THAT() from Google Mock to Google Test. At that time, we
// can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as // can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as
// EXPECT_THAT() and the matchers know how to print tuples. // EXPECT_THAT() and the matchers know how to print tuples.
......
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: vladl@google.com (Vlad Losev) // The Google C++ Testing and Mocking Framework (Google Test)
//
// The Google C++ Testing Framework (Google Test)
// //
// This header file provides classes and functions used internally // This header file provides classes and functions used internally
// for testing Google Test itself. // for testing Google Test itself.
......
...@@ -26,35 +26,35 @@ ...@@ -26,35 +26,35 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
// //
// Tests for Google Test itself. This verifies that the basic constructs of // Tests for Google Test itself. This verifies that the basic constructs of
// Google Test work. // Google Test work.
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gtest-param-test_test.h" #include "test/googletest-param-test-test.h"
using ::testing::Values; using ::testing::Values;
using ::testing::internal::ParamGenerator; using ::testing::internal::ParamGenerator;
// Tests that generators defined in a different translation unit // Tests that generators defined in a different translation unit
// are functional. The test using extern_gen is defined // are functional. The test using extern_gen is defined
// in gtest-param-test_test.cc. // in googletest-param-test-test.cc.
ParamGenerator<int> extern_gen = Values(33); ParamGenerator<int> extern_gen = Values(33);
// Tests that a parameterized test case can be defined in one translation unit // Tests that a parameterized test case can be defined in one translation unit
// and instantiated in another. The test is defined in gtest-param-test_test.cc // and instantiated in another. The test is defined in
// and ExternalInstantiationTest fixture class is defined in // googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// gtest-param-test_test.h. // defined in gtest-param-test_test.h.
INSTANTIATE_TEST_CASE_P(MultiplesOf33, INSTANTIATE_TEST_CASE_P(MultiplesOf33,
ExternalInstantiationTest, ExternalInstantiationTest,
Values(33, 66)); Values(33, 66));
// Tests that a parameterized test case can be instantiated // Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined // in multiple translation units. Another instantiation is defined
// in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest // in googletest-param-test-test.cc and
// fixture is defined in gtest-param-test_test.h // InstantiationInMultipleTranslaionUnitsTest fixture is defined in
// gtest-param-test_test.h
INSTANTIATE_TEST_CASE_P(Sequence2, INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest, InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5)); Values(42*3, 42*4, 42*5));
......
...@@ -27,14 +27,11 @@ ...@@ -27,14 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan)
//
// This file tests the internal cross-platform support utilities. // This file tests the internal cross-platform support utilities.
#include <stdio.h>
#include "gtest/internal/gtest-port.h" #include "gtest/internal/gtest-port.h"
#include <stdio.h>
#if GTEST_OS_MAC #if GTEST_OS_MAC
# include <time.h> # include <time.h>
#endif // GTEST_OS_MAC #endif // GTEST_OS_MAC
...@@ -67,8 +64,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { ...@@ -67,8 +64,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) {
} }
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
EXPECT_FALSE(IsXDigit(static_cast<char>(0x80))); EXPECT_FALSE(IsXDigit(static_cast<char>('\x80')));
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80))); EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
} }
TEST(IsXDigitTest, WorksForWideAscii) { TEST(IsXDigitTest, WorksForWideAscii) {
...@@ -227,7 +224,7 @@ TEST(ScopedPtrTest, DefinesElementType) { ...@@ -227,7 +224,7 @@ TEST(ScopedPtrTest, DefinesElementType) {
StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>(); StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>();
} }
// TODO(vladl@google.com): Implement THE REST of scoped_ptr tests. // FIXME: Implement THE REST of scoped_ptr tests.
TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
if (AlwaysFalse()) if (AlwaysFalse())
...@@ -296,7 +293,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) { ...@@ -296,7 +293,7 @@ TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) {
EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1)); EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1));
} }
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX #if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA
void* ThreadFunc(void* data) { void* ThreadFunc(void* data) {
internal::Mutex* mutex = static_cast<internal::Mutex*>(data); internal::Mutex* mutex = static_cast<internal::Mutex*>(data);
mutex->Lock(); mutex->Lock();
...@@ -340,17 +337,17 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) { ...@@ -340,17 +337,17 @@ TEST(GetThreadCountTest, ReturnsCorrectValue) {
TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) { TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) {
EXPECT_EQ(0U, GetThreadCount()); EXPECT_EQ(0U, GetThreadCount());
} }
#endif // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX #endif // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_FUCHSIA
TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) { TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
const bool a_false_condition = false; const bool a_false_condition = false;
const char regex[] = const char regex[] =
#ifdef _MSC_VER #ifdef _MSC_VER
"gtest-port_test\\.cc\\(\\d+\\):" "googletest-port-test\\.cc\\(\\d+\\):"
#elif GTEST_USES_POSIX_RE #elif GTEST_USES_POSIX_RE
"gtest-port_test\\.cc:[0-9]+" "googletest-port-test\\.cc:[0-9]+"
#else #else
"gtest-port_test\\.cc:\\d+" "googletest-port-test\\.cc:\\d+"
#endif // _MSC_VER #endif // _MSC_VER
".*a_false_condition.*Extra info.*"; ".*a_false_condition.*Extra info.*";
......
...@@ -26,15 +26,12 @@ ...@@ -26,15 +26,12 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Google Test - The Google C++ Testing Framework
// Google Test - The Google C++ Testing and Mocking Framework
// //
// This file tests the universal value printer. // This file tests the universal value printer.
#include "gtest/gtest-printers.h"
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
...@@ -48,6 +45,7 @@ ...@@ -48,6 +45,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "gtest/gtest-printers.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#if GTEST_HAS_UNORDERED_MAP_ #if GTEST_HAS_UNORDERED_MAP_
...@@ -572,7 +570,7 @@ struct Foo { ...@@ -572,7 +570,7 @@ struct Foo {
TEST(PrintPointerTest, MemberVariablePointer) { TEST(PrintPointerTest, MemberVariablePointer) {
EXPECT_TRUE(HasPrefix(Print(&Foo::value), EXPECT_TRUE(HasPrefix(Print(&Foo::value),
Print(sizeof(&Foo::value)) + "-byte object ")); Print(sizeof(&Foo::value)) + "-byte object "));
int (Foo::*p) = NULL; // NOLINT int Foo::*p = NULL; // NOLINT
EXPECT_TRUE(HasPrefix(Print(p), EXPECT_TRUE(HasPrefix(Print(p),
Print(sizeof(p)) + "-byte object ")); Print(sizeof(p)) + "-byte object "));
} }
...@@ -920,8 +918,6 @@ TEST(PrintStlContainerTest, MultiSet) { ...@@ -920,8 +918,6 @@ TEST(PrintStlContainerTest, MultiSet) {
} }
#if GTEST_HAS_STD_FORWARD_LIST_ #if GTEST_HAS_STD_FORWARD_LIST_
// <slist> is available on Linux in the google3 mode, but not on
// Windows or Mac OS X.
TEST(PrintStlContainerTest, SinglyLinkedList) { TEST(PrintStlContainerTest, SinglyLinkedList) {
int a[] = { 9, 2, 8 }; int a[] = { 9, 2, 8 };
...@@ -1115,6 +1111,12 @@ TEST(PrintStdTupleTest, NestedTuple) { ...@@ -1115,6 +1111,12 @@ TEST(PrintStdTupleTest, NestedTuple) {
#endif // GTEST_LANG_CXX11 #endif // GTEST_LANG_CXX11
#if GTEST_LANG_CXX11
TEST(PrintNullptrT, Basic) {
EXPECT_EQ("(nullptr)", Print(nullptr));
}
#endif // GTEST_LANG_CXX11
// Tests printing user-defined unprintable types. // Tests printing user-defined unprintable types.
// Unprintable types in the global namespace. // Unprintable types in the global namespace.
...@@ -1244,7 +1246,7 @@ TEST(PrintReferenceTest, HandlesMemberFunctionPointer) { ...@@ -1244,7 +1246,7 @@ TEST(PrintReferenceTest, HandlesMemberFunctionPointer) {
// Tests that the universal printer prints a member variable pointer // Tests that the universal printer prints a member variable pointer
// passed by reference. // passed by reference.
TEST(PrintReferenceTest, HandlesMemberVariablePointer) { TEST(PrintReferenceTest, HandlesMemberVariablePointer) {
int (Foo::*p) = &Foo::value; // NOLINT int Foo::*p = &Foo::value; // NOLINT
EXPECT_TRUE(HasPrefix( EXPECT_TRUE(HasPrefix(
PrintByRef(p), PrintByRef(p),
"@" + PrintPointer(&p) + " " + Print(sizeof(p)) + "-byte object ")); "@" + PrintPointer(&p) + " " + Print(sizeof(p)) + "-byte object "));
...@@ -1725,6 +1727,21 @@ TEST(PrintOptionalTest, Basic) { ...@@ -1725,6 +1727,21 @@ TEST(PrintOptionalTest, Basic) {
EXPECT_EQ("(1.1)", PrintToString(absl::optional<double>{1.1})); EXPECT_EQ("(1.1)", PrintToString(absl::optional<double>{1.1}));
EXPECT_EQ("(\"A\")", PrintToString(absl::optional<std::string>{"A"})); EXPECT_EQ("(\"A\")", PrintToString(absl::optional<std::string>{"A"}));
} }
struct NonPrintable {
unsigned char contents = 17;
};
TEST(PrintOneofTest, Basic) {
using Type = absl::variant<int, StreamableInGlobal, NonPrintable>;
EXPECT_EQ("('int' with value 7)", PrintToString(Type(7)));
EXPECT_EQ("('StreamableInGlobal' with value StreamableInGlobal)",
PrintToString(Type(StreamableInGlobal{})));
EXPECT_EQ(
"('testing::gtest_printers_test::NonPrintable' with value 1-byte object "
"<11>)",
PrintToString(Type(NonPrintable{})));
}
#endif // GTEST_HAS_ABSL #endif // GTEST_HAS_ABSL
} // namespace gtest_printers_test } // namespace gtest_printers_test
......
...@@ -30,13 +30,11 @@ ...@@ -30,13 +30,11 @@
"""Verifies that test shuffling works.""" """Verifies that test shuffling works."""
__author__ = 'wan@google.com (Zhanyong Wan)'
import os import os
import gtest_test_utils import gtest_test_utils
# Command to run the gtest_shuffle_test_ program. # Command to run the googletest-shuffle-test_ program.
COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_') COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-shuffle-test_')
# The environment variables for test sharding. # The environment variables for test sharding.
TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS' TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS'
...@@ -89,7 +87,7 @@ def GetTestsForAllIterations(extra_env, args): ...@@ -89,7 +87,7 @@ def GetTestsForAllIterations(extra_env, args):
Args: Args:
extra_env: a map from environment variables to their values extra_env: a map from environment variables to their values
args: command line flags to pass to gtest_shuffle_test_ args: command line flags to pass to googletest-shuffle-test_
Returns: Returns:
A list where the i-th element is the list of tests run in the i-th A list where the i-th element is the list of tests run in the i-th
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Verifies that test shuffling works. // Verifies that test shuffling works.
......
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: mheule@google.com (Markus Heule)
//
#include "gtest/gtest-test-part.h" #include "gtest/gtest-test-part.h"
...@@ -203,6 +200,6 @@ TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) { ...@@ -203,6 +200,6 @@ TEST_F(TestPartResultArrayDeathTest, DiesWhenIndexIsOutOfBound) {
EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(1), ""); EXPECT_DEATH_IF_SUPPORTED(results.GetTestPartResult(1), "");
} }
// TODO(mheule@google.com): Add a test for the class HasNewFatalFailureHelper. // FIXME: Add a test for the class HasNewFatalFailureHelper.
} // namespace } // namespace
// Copyright 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Tests for Google Test itself. This verifies that the basic constructs of
// Google Test work.
#include "gtest/gtest.h"
#include "googletest-param-test-test.h"
using ::testing::Values;
using ::testing::internal::ParamGenerator;
// Tests that generators defined in a different translation unit
// are functional. The test using extern_gen_2 is defined
// in googletest-param-test-test.cc.
ParamGenerator<int> extern_gen_2 = Values(33);
// Tests that a parameterized test case can be defined in one translation unit
// and instantiated in another. The test is defined in
// googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
// defined in gtest-param-test_test.h.
INSTANTIATE_TEST_CASE_P(MultiplesOf33,
ExternalInstantiationTest,
Values(33, 66));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in googletest-param-test-test.cc and
// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
// gtest-param-test_test.h
INSTANTIATE_TEST_CASE_P(Sequence2,
InstantiationInMultipleTranslaionUnitsTest,
Values(42*3, 42*4, 42*5));
...@@ -31,12 +31,10 @@ ...@@ -31,12 +31,10 @@
"""Tests Google Test's throw-on-failure mode with exceptions disabled. """Tests Google Test's throw-on-failure mode with exceptions disabled.
This script invokes gtest_throw_on_failure_test_ (a program written with This script invokes googletest-throw-on-failure-test_ (a program written with
Google Test) with different environments and command line flags. Google Test) with different environments and command line flags.
""" """
__author__ = 'wan@google.com (Zhanyong Wan)'
import os import os
import gtest_test_utils import gtest_test_utils
...@@ -46,10 +44,10 @@ import gtest_test_utils ...@@ -46,10 +44,10 @@ import gtest_test_utils
# The command line flag for enabling/disabling the throw-on-failure mode. # The command line flag for enabling/disabling the throw-on-failure mode.
THROW_ON_FAILURE = 'gtest_throw_on_failure' THROW_ON_FAILURE = 'gtest_throw_on_failure'
# Path to the gtest_throw_on_failure_test_ program, compiled with # Path to the googletest-throw-on-failure-test_ program, compiled with
# exceptions disabled. # exceptions disabled.
EXE_PATH = gtest_test_utils.GetTestExecutablePath( EXE_PATH = gtest_test_utils.GetTestExecutablePath(
'gtest_throw_on_failure_test_') 'googletest-throw-on-failure-test_')
# Utilities. # Utilities.
...@@ -75,13 +73,13 @@ def Run(command): ...@@ -75,13 +73,13 @@ def Run(command):
return p.exited and p.exit_code == 0 return p.exited and p.exit_code == 0
# The tests. TODO(wan@google.com): refactor the class to share common # The tests. FIXME: refactor the class to share common
# logic with code in gtest_break_on_failure_unittest.py. # logic with code in googletest-break-on-failure-unittest.py.
class ThrowOnFailureTest(gtest_test_utils.TestCase): class ThrowOnFailureTest(gtest_test_utils.TestCase):
"""Tests the throw-on-failure mode.""" """Tests the throw-on-failure mode."""
def RunAndVerify(self, env_var_value, flag_value, should_fail): def RunAndVerify(self, env_var_value, flag_value, should_fail):
"""Runs gtest_throw_on_failure_test_ and verifies that it does """Runs googletest-throw-on-failure-test_ and verifies that it does
(or does not) exit with a non-zero code. (or does not) exit with a non-zero code.
Args: Args:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment