aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test/gtest_output_test_.cc
diff options
context:
space:
mode:
authorTanzinul Islam <tanzislam@users.noreply.github.com>2018-03-05 02:25:59 +0000
committerGitHub <noreply@github.com>2018-03-05 02:25:59 +0000
commita7a7f51d355081a7f1e8ab295d5df5f9bb4612c8 (patch)
treec6f8f6067f957eb6d49656278f79c93353bb039c /googletest/test/gtest_output_test_.cc
parent4ba3803f936a2f432e60841bc9358ea2f3a951eb (diff)
parent6c73adfc03e277f55cb1e4947b3a5e6c5ff4fe46 (diff)
downloadgoogletest-a7a7f51d355081a7f1e8ab295d5df5f9bb4612c8.tar.gz
googletest-a7a7f51d355081a7f1e8ab295d5df5f9bb4612c8.tar.bz2
googletest-a7a7f51d355081a7f1e8ab295d5df5f9bb4612c8.zip
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
Diffstat (limited to 'googletest/test/gtest_output_test_.cc')
-rw-r--r--googletest/test/gtest_output_test_.cc29
1 files changed, 17 insertions, 12 deletions
diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc
index e5fa764e..9ae9dc60 100644
--- a/googletest/test/gtest_output_test_.cc
+++ b/googletest/test/gtest_output_test_.cc
@@ -37,15 +37,7 @@
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
-
-// Indicates that this translation unit is part of Google Test's
-// implementation. It must come before gtest-internal-inl.h is
-// included, or there will be a compiler error. This trick is to
-// prevent a user from accidentally including gtest-internal-inl.h in
-// their code.
-#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION_
#include <stdlib.h>
@@ -176,6 +168,16 @@ void SubWithTrace(int n) {
SubWithoutTrace(n);
}
+TEST(SCOPED_TRACETest, AcceptedValues) {
+ SCOPED_TRACE("literal string");
+ SCOPED_TRACE(std::string("std::string"));
+ SCOPED_TRACE(1337); // streamable type
+ const char* null_value = NULL;
+ SCOPED_TRACE(null_value);
+
+ ADD_FAILURE() << "Just checking that all these values work fine.";
+}
+
// Tests that SCOPED_TRACE() obeys lexical scopes.
TEST(SCOPED_TRACETest, ObeysScopes) {
printf("(expected to fail)\n");
@@ -323,6 +325,13 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
}
#endif // GTEST_IS_THREADSAFE
+// Tests basic functionality of the ScopedTrace utility (most of its features
+// are already tested in SCOPED_TRACETest).
+TEST(ScopedTraceTest, WithExplicitFileAndLine) {
+ testing::ScopedTrace trace("explicit_file.cc", 123, "expected trace message");
+ ADD_FAILURE() << "Check that the trace is attached to a particular location.";
+}
+
TEST(DisabledTestsWarningTest,
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
// This test body is intentionally empty. Its sole purpose is for
@@ -757,8 +766,6 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
// This #ifdef block tests the output of value-parameterized tests.
-#if GTEST_HAS_PARAM_TEST
-
std::string ParamNameFunc(const testing::TestParamInfo<std::string>& info) {
return info.param;
}
@@ -779,8 +786,6 @@ INSTANTIATE_TEST_CASE_P(PrintingStrings,
testing::Values(std::string("a")),
ParamNameFunc);
-#endif // GTEST_HAS_PARAM_TEST
-
// This #ifdef block tests the output of typed tests.
#if GTEST_HAS_TYPED_TEST