proxygen
testing::TestInfo Class Reference

#include <gtest.h>

Public Member Functions

 ~TestInfo ()
 
const char * test_case_name () const
 
const char * name () const
 
const char * type_param () const
 
const char * value_param () const
 
const char * file () const
 
int line () const
 
bool should_run () const
 
bool is_reportable () const
 
const TestResultresult () const
 
 ~TestInfo ()
 
const char * test_case_name () const
 
const char * name () const
 
const char * type_param () const
 
const char * value_param () const
 
const char * file () const
 
int line () const
 
bool should_run () const
 
bool is_reportable () const
 
const TestResultresult () const
 
 ~TestInfo ()
 
const char * test_case_name () const
 
const char * name () const
 
const char * type_param () const
 
const char * value_param () const
 
const char * file () const
 
int line () const
 
bool should_run () const
 
bool is_reportable () const
 
const TestResultresult () const
 

Private Member Functions

 TestInfo (const std::string &test_case_name, const std::string &name, const char *a_type_param, const char *a_value_param, internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase *factory)
 
int increment_death_test_count ()
 
void Run ()
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (TestInfo)
 
 TestInfo (const std::string &test_case_name, const std::string &name, const char *a_type_param, const char *a_value_param, internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase *factory)
 
int increment_death_test_count ()
 
void Run ()
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (TestInfo)
 
 TestInfo (const std::string &test_case_name, const std::string &name, const char *a_type_param, const char *a_value_param, internal::CodeLocation a_code_location, internal::TypeId fixture_class_id, internal::TestFactoryBase *factory)
 
int increment_death_test_count ()
 
void Run ()
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (TestInfo)
 

Static Private Member Functions

static void ClearTestResult (TestInfo *test_info)
 
static void ClearTestResult (TestInfo *test_info)
 
static void ClearTestResult (TestInfo *test_info)
 

Private Attributes

const std::string test_case_name_
 
const std::string name_
 
const internal::scoped_ptr< const ::std::stringtype_param_
 
const internal::scoped_ptr< const ::std::stringvalue_param_
 
internal::CodeLocation location_
 
const internal::TypeId fixture_class_id_
 
bool should_run_
 
bool is_disabled_
 
bool matches_filter_
 
internal::TestFactoryBase *const factory_
 
TestResult result_
 

Friends

class Test
 
class TestCase
 
class internal::UnitTestImpl
 
class internal::StreamingListenerTest
 
TestInfointernal::MakeAndRegisterTestInfo (const char *test_case_name, const char *name, const char *type_param, const char *value_param, internal::CodeLocation code_location, internal::TypeId fixture_class_id, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, internal::TestFactoryBase *factory)
 
TestInfointernal::MakeAndRegisterTestInfo (const char *test_case_name, const char *name, const char *type_param, const char *value_param, internal::CodeLocation code_location, internal::TypeId fixture_class_id, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, internal::TestFactoryBase *factory)
 
TestInfointernal::MakeAndRegisterTestInfo (const char *test_case_name, const char *name, const char *type_param, const char *value_param, internal::CodeLocation code_location, internal::TypeId fixture_class_id, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc, internal::TestFactoryBase *factory)
 

Detailed Description

Definition at line 644 of file gtest.h.

Constructor & Destructor Documentation

testing::TestInfo::~TestInfo ( )

Definition at line 2521 of file gtest.cc.

References factory_.

Referenced by testing::TestPartNonfatallyFailed().

2521 { delete factory_; }
internal::TestFactoryBase *const factory_
Definition: gtest.h:765
testing::TestInfo::TestInfo ( const std::string test_case_name,
const std::string name,
const char *  a_type_param,
const char *  a_value_param,
internal::CodeLocation  a_code_location,
internal::TypeId  fixture_class_id,
internal::TestFactoryBase factory 
)
private

Definition at line 2501 of file gtest.cc.

Referenced by testing::internal::MakeAndRegisterTestInfo(), and testing::TestPartNonfatallyFailed().

2508  : test_case_name_(a_test_case_name),
2509  name_(a_name),
2510  type_param_(a_type_param ? new std::string(a_type_param) : NULL),
2511  value_param_(a_value_param ? new std::string(a_value_param) : NULL),
2512  location_(a_code_location),
2513  fixture_class_id_(fixture_class_id),
2514  should_run_(false),
2515  is_disabled_(false),
2516  matches_filter_(false),
2517  factory_(factory),
2518  result_() {}
bool should_run_
Definition: gtest.h:761
bool matches_filter_
Definition: gtest.h:763
const std::string name_
Definition: gtest.h:752
TestResult result_
Definition: gtest.h:770
const internal::TypeId fixture_class_id_
Definition: gtest.h:760
const internal::scoped_ptr< const ::std::string > type_param_
Definition: gtest.h:755
internal::TestFactoryBase *const factory_
Definition: gtest.h:765
const char * string
Definition: Conv.cpp:212
bool is_disabled_
Definition: gtest.h:762
const internal::scoped_ptr< const ::std::string > value_param_
Definition: gtest.h:758
internal::CodeLocation location_
Definition: gtest.h:759
const std::string test_case_name_
Definition: gtest.h:751
testing::TestInfo::~TestInfo ( )
testing::TestInfo::TestInfo ( const std::string test_case_name,
const std::string name,
const char *  a_type_param,
const char *  a_value_param,
internal::CodeLocation  a_code_location,
internal::TypeId  fixture_class_id,
internal::TestFactoryBase factory 
)
private
testing::TestInfo::~TestInfo ( )
testing::TestInfo::TestInfo ( const std::string test_case_name,
const std::string name,
const char *  a_type_param,
const char *  a_value_param,
internal::CodeLocation  a_code_location,
internal::TypeId  fixture_class_id,
internal::TestFactoryBase factory 
)
private

Member Function Documentation

static void testing::TestInfo::ClearTestResult ( TestInfo test_info)
inlinestaticprivate

Definition at line 746 of file gtest.h.

References testing::TestResult::Clear(), and result_.

Referenced by testing::TestCase::ClearResult().

746  {
747  test_info->result_.Clear();
748  }
static void testing::TestInfo::ClearTestResult ( TestInfo test_info)
inlinestaticprivate

Definition at line 746 of file gtest.h.

References testing::TestResult::Clear(), GTEST_API_, GTEST_DISALLOW_COPY_AND_ASSIGN_, name, name_, result_, string, and gmock_test_utils::TestCase.

746  {
747  test_info->result_.Clear();
748  }
static void testing::TestInfo::ClearTestResult ( TestInfo test_info)
inlinestaticprivate

Definition at line 746 of file gtest.h.

References testing::TestResult::Clear(), GTEST_API_, GTEST_DISALLOW_COPY_AND_ASSIGN_, name, name_, result_, string, and gmock_test_utils::TestCase.

746  {
747  test_info->result_.Clear();
748  }
const char* testing::TestInfo::file ( ) const
inline

Definition at line 673 of file gtest.h.

673 { return location_.file.c_str(); }
internal::CodeLocation location_
Definition: gtest.h:759
const char* testing::TestInfo::file ( ) const
inline

Definition at line 673 of file gtest.h.

673 { return location_.file.c_str(); }
internal::CodeLocation location_
Definition: gtest.h:759
const char* testing::TestInfo::file ( ) const
inline

Definition at line 673 of file gtest.h.

673 { return location_.file.c_str(); }
internal::CodeLocation location_
Definition: gtest.h:759
testing::TestInfo::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( TestInfo  )
private
testing::TestInfo::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( TestInfo  )
private
testing::TestInfo::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( TestInfo  )
private
int testing::TestInfo::increment_death_test_count ( )
inlineprivate

Definition at line 738 of file gtest.h.

References Run().

738  {
740  }
int increment_death_test_count()
Definition: gtest.h:608
TestResult result_
Definition: gtest.h:770
int testing::TestInfo::increment_death_test_count ( )
inlineprivate

Definition at line 738 of file gtest.h.

References Run().

738  {
740  }
int increment_death_test_count()
Definition: gtest.h:608
TestResult result_
Definition: gtest.h:770
int testing::TestInfo::increment_death_test_count ( )
inlineprivate

Definition at line 738 of file gtest.h.

References Run().

738  {
740  }
int increment_death_test_count()
Definition: gtest.h:608
TestResult result_
Definition: gtest.h:770
bool testing::TestInfo::is_reportable ( ) const
inline

Definition at line 697 of file gtest.h.

697  {
698  // For now, the XML report includes all tests matching the filter.
699  // In the future, we may trim tests that are excluded because of
700  // sharding.
701  return matches_filter_;
702  }
bool matches_filter_
Definition: gtest.h:763
bool testing::TestInfo::is_reportable ( ) const
inline

Definition at line 697 of file gtest.h.

697  {
698  // For now, the XML report includes all tests matching the filter.
699  // In the future, we may trim tests that are excluded because of
700  // sharding.
701  return matches_filter_;
702  }
bool matches_filter_
Definition: gtest.h:763
bool testing::TestInfo::is_reportable ( ) const
inline

Definition at line 697 of file gtest.h.

Referenced by testing::internal::XmlUnitTestResultPrinter::OutputXmlTestInfo(), testing::internal::PortableLocaltime(), testing::TestCase::TestReportable(), and testing::TestCase::TestReportableDisabled().

697  {
698  // For now, the XML report includes all tests matching the filter.
699  // In the future, we may trim tests that are excluded because of
700  // sharding.
701  return matches_filter_;
702  }
bool matches_filter_
Definition: gtest.h:763
int testing::TestInfo::line ( ) const
inline

Definition at line 676 of file gtest.h.

676 { return location_.line; }
internal::CodeLocation location_
Definition: gtest.h:759
int testing::TestInfo::line ( ) const
inline

Definition at line 676 of file gtest.h.

676 { return location_.line; }
internal::CodeLocation location_
Definition: gtest.h:759
int testing::TestInfo::line ( ) const
inline

Definition at line 676 of file gtest.h.

676 { return location_.line; }
internal::CodeLocation location_
Definition: gtest.h:759
const char* testing::TestInfo::name ( ) const
inline

Definition at line 654 of file gtest.h.

References name_.

654 { return name_.c_str(); }
const std::string name_
Definition: gtest.h:752
const char* testing::TestInfo::name ( ) const
inline

Definition at line 654 of file gtest.h.

References name_.

654 { return name_.c_str(); }
const std::string name_
Definition: gtest.h:752
const TestResult* testing::TestInfo::result ( ) const
inline

Definition at line 705 of file gtest.h.

References testing::internal::MakeAndRegisterTestInfo(), name, and string.

705 { return &result_; }
TestResult result_
Definition: gtest.h:770
const TestResult* testing::TestInfo::result ( ) const
inline

Definition at line 705 of file gtest.h.

References testing::internal::MakeAndRegisterTestInfo(), name, and string.

705 { return &result_; }
TestResult result_
Definition: gtest.h:770
void testing::TestInfo::Run ( )
private
void testing::TestInfo::Run ( )
private

Definition at line 2630 of file gtest.cc.

References testing::internal::TestFactoryBase::CreateTest(), testing::Test::DeleteSelf_(), factory_, testing::UnitTest::GetInstance(), testing::internal::GetTimeInMillis(), testing::internal::GetUnitTestImpl(), testing::internal::HandleExceptionsInMethodIfSupported(), testing::Test::HasFatalFailure(), testing::UnitTest::listeners(), testing::TestEventListener::OnTestEnd(), testing::TestEventListener::OnTestStart(), testing::internal::UnitTestImpl::os_stack_trace_getter(), testing::TestEventListeners::repeater(), result_, testing::Test::Run(), testing::internal::UnitTestImpl::set_current_test_info(), testing::TestResult::set_elapsed_time(), should_run_, start, and testing::internal::OsStackTraceGetterInterface::UponLeavingGTest().

Referenced by testing::TestCase::Run().

2630  {
2631  if (!should_run_) return;
2632 
2633  // Tells UnitTest where to store test result.
2635  impl->set_current_test_info(this);
2636 
2637  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
2638 
2639  // Notifies the unit test event listeners that a test is about to start.
2640  repeater->OnTestStart(*this);
2641 
2643 
2644  impl->os_stack_trace_getter()->UponLeavingGTest();
2645 
2646  // Creates the test object.
2649  "the test fixture's constructor");
2650 
2651  // Runs the test only if the test object was created and its
2652  // constructor didn't generate a fatal failure.
2653  if ((test != NULL) && !Test::HasFatalFailure()) {
2654  // This doesn't throw as all user code that can throw are wrapped into
2655  // exception handling code.
2656  test->Run();
2657  }
2658 
2659  // Deletes the test object.
2660  impl->os_stack_trace_getter()->UponLeavingGTest();
2662  test, &Test::DeleteSelf_, "the test fixture's destructor");
2663 
2665 
2666  // Notifies the unit test event listener that a test has just finished.
2667  repeater->OnTestEnd(*this);
2668 
2669  // Tells UnitTest to stop associating assertion results to this
2670  // test.
2671  impl->set_current_test_info(NULL);
2672 }
class UnitTestImpl * GetUnitTestImpl()
Result HandleExceptionsInMethodIfSupported(T *object, Result(T::*method)(), const char *location)
Definition: gtest.cc:2410
static bool HasFatalFailure()
Definition: gtest.cc:2487
bool should_run_
Definition: gtest.h:761
TestEventListener * repeater()
Definition: gtest.cc:3919
void set_elapsed_time(TimeInMillis elapsed)
Definition: gtest.h:584
virtual void OnTestStart(const TestInfo &test_info)=0
friend class Test
Definition: gtest.h:711
internal::TimeInMillis TimeInMillis
Definition: gtest.h:480
TestResult result_
Definition: gtest.h:770
TestEventListeners & listeners()
Definition: gtest.cc:4081
friend class internal::UnitTestImpl
Definition: gtest.h:713
GTEST_API_ TimeInMillis GetTimeInMillis()
Definition: gtest.cc:806
internal::TestFactoryBase *const factory_
Definition: gtest.h:765
auto start
void DeleteSelf_()
Definition: gtest.h:453
static UnitTest * GetInstance()
Definition: gtest.cc:3972
void testing::TestInfo::Run ( )
private
bool testing::TestInfo::should_run ( ) const
inline

Definition at line 694 of file gtest.h.

694 { return should_run_; }
bool should_run_
Definition: gtest.h:761
bool testing::TestInfo::should_run ( ) const
inline

Definition at line 694 of file gtest.h.

694 { return should_run_; }
bool should_run_
Definition: gtest.h:761
const char* testing::TestInfo::test_case_name ( ) const
inline

Definition at line 651 of file gtest.h.

651 { return test_case_name_.c_str(); }
const std::string test_case_name_
Definition: gtest.h:751
const char* testing::TestInfo::test_case_name ( ) const
inline

Definition at line 651 of file gtest.h.

651 { return test_case_name_.c_str(); }
const std::string test_case_name_
Definition: gtest.h:751
const char* testing::TestInfo::type_param ( ) const
inline

Definition at line 658 of file gtest.h.

658  {
659  if (type_param_.get() != NULL)
660  return type_param_->c_str();
661  return NULL;
662  }
const internal::scoped_ptr< const ::std::string > type_param_
Definition: gtest.h:755
const char* testing::TestInfo::type_param ( ) const
inline

Definition at line 658 of file gtest.h.

658  {
659  if (type_param_.get() != NULL)
660  return type_param_->c_str();
661  return NULL;
662  }
const internal::scoped_ptr< const ::std::string > type_param_
Definition: gtest.h:755
const char* testing::TestInfo::type_param ( ) const
inline

Definition at line 658 of file gtest.h.

Referenced by testing::internal::UnitTestImpl::AddTestInfo(), testing::internal::XmlUnitTestResultPrinter::OutputXmlTestInfo(), testing::internal::PortableLocaltime(), and testing::internal::PrintFullTestCommentIfPresent().

658  {
659  if (type_param_.get() != NULL)
660  return type_param_->c_str();
661  return NULL;
662  }
const internal::scoped_ptr< const ::std::string > type_param_
Definition: gtest.h:755
const char* testing::TestInfo::value_param ( ) const
inline
const char* testing::TestInfo::value_param ( ) const
inline

Definition at line 666 of file gtest.h.

666  {
667  if (value_param_.get() != NULL)
668  return value_param_->c_str();
669  return NULL;
670  }
const internal::scoped_ptr< const ::std::string > value_param_
Definition: gtest.h:758
const char* testing::TestInfo::value_param ( ) const
inline

Definition at line 666 of file gtest.h.

666  {
667  if (value_param_.get() != NULL)
668  return value_param_->c_str();
669  return NULL;
670  }
const internal::scoped_ptr< const ::std::string > value_param_
Definition: gtest.h:758

Friends And Related Function Documentation

TestInfo* internal::MakeAndRegisterTestInfo ( const char *  test_case_name,
const char *  name,
const char *  type_param,
const char *  value_param,
internal::CodeLocation  code_location,
internal::TypeId  fixture_class_id,
Test::SetUpTestCaseFunc  set_up_tc,
Test::TearDownTestCaseFunc  tear_down_tc,
internal::TestFactoryBase factory 
)
friend
TestInfo* internal::MakeAndRegisterTestInfo ( const char *  test_case_name,
const char *  name,
const char *  type_param,
const char *  value_param,
internal::CodeLocation  code_location,
internal::TypeId  fixture_class_id,
Test::SetUpTestCaseFunc  set_up_tc,
Test::TearDownTestCaseFunc  tear_down_tc,
internal::TestFactoryBase factory 
)
friend
TestInfo* internal::MakeAndRegisterTestInfo ( const char *  test_case_name,
const char *  name,
const char *  type_param,
const char *  value_param,
internal::CodeLocation  code_location,
internal::TypeId  fixture_class_id,
Test::SetUpTestCaseFunc  set_up_tc,
Test::TearDownTestCaseFunc  tear_down_tc,
internal::TestFactoryBase factory 
)
friend
internal::StreamingListenerTest
friend

Definition at line 714 of file gtest.h.

Definition at line 713 of file gtest.h.

Test
friend

Definition at line 711 of file gtest.h.

TestCase
friend

Definition at line 712 of file gtest.h.

Member Data Documentation

internal::TestFactoryBase *const testing::TestInfo::factory_
private

Definition at line 765 of file gtest.h.

Referenced by Run(), and ~TestInfo().

const internal::TypeId testing::TestInfo::fixture_class_id_
private
internal::CodeLocation testing::TestInfo::location_
private

Definition at line 759 of file gtest.h.

const std::string testing::TestInfo::name_
private

Definition at line 752 of file gtest.h.

Referenced by testing::internal::MakeAndRegisterTestInfo().

bool testing::TestInfo::should_run_
private
const std::string testing::TestInfo::test_case_name_
private

Definition at line 751 of file gtest.h.

const internal::scoped_ptr< const ::std::string > testing::TestInfo::type_param_
private

Definition at line 755 of file gtest.h.

const internal::scoped_ptr< const ::std::string > testing::TestInfo::value_param_
private

Definition at line 758 of file gtest.h.


The documentation for this class was generated from the following files: