diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-16 19:54:05 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-16 19:54:05 +0000 |
commit | d56773b492b7b675d5c547baab815289a7815bdd (patch) | |
tree | 59322de2099c9879b4a10a298ecf6e6b03a63ace /src | |
parent | 3508784108a38d673a0c7d14c897e7a51b2a7e36 (diff) | |
download | googletest-d56773b492b7b675d5c547baab815289a7815bdd.tar.gz googletest-d56773b492b7b675d5c547baab815289a7815bdd.tar.bz2 googletest-d56773b492b7b675d5c547baab815289a7815bdd.zip |
Turns on -Wshadow (by Preston Jackson).
Diffstat (limited to 'src')
-rw-r--r-- | src/gtest-death-test.cc | 32 | ||||
-rw-r--r-- | src/gtest-internal-inl.h | 8 | ||||
-rw-r--r-- | src/gtest.cc | 43 |
3 files changed, 42 insertions, 41 deletions
diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc index 106b01c7..5f2fbbcf 100644 --- a/src/gtest-death-test.cc +++ b/src/gtest-death-test.cc @@ -308,9 +308,9 @@ String DeathTest::last_death_test_message_; // Provides cross platform implementation for some death functionality. class DeathTestImpl : public DeathTest { protected: - DeathTestImpl(const char* statement, const RE* regex) - : statement_(statement), - regex_(regex), + DeathTestImpl(const char* a_statement, const RE* a_regex) + : statement_(a_statement), + regex_(a_regex), spawned_(false), status_(-1), outcome_(IN_PROGRESS), @@ -326,11 +326,11 @@ class DeathTestImpl : public DeathTest { const char* statement() const { return statement_; } const RE* regex() const { return regex_; } bool spawned() const { return spawned_; } - void set_spawned(bool spawned) { spawned_ = spawned; } + void set_spawned(bool is_spawned) { spawned_ = is_spawned; } int status() const { return status_; } - void set_status(int status) { status_ = status; } + void set_status(int a_status) { status_ = a_status; } DeathTestOutcome outcome() const { return outcome_; } - void set_outcome(DeathTestOutcome outcome) { outcome_ = outcome; } + void set_outcome(DeathTestOutcome an_outcome) { outcome_ = an_outcome; } int read_fd() const { return read_fd_; } void set_read_fd(int fd) { read_fd_ = fd; } int write_fd() const { return write_fd_; } @@ -705,8 +705,8 @@ class ForkingDeathTest : public DeathTestImpl { }; // Constructs a ForkingDeathTest. -ForkingDeathTest::ForkingDeathTest(const char* statement, const RE* regex) - : DeathTestImpl(statement, regex), +ForkingDeathTest::ForkingDeathTest(const char* a_statement, const RE* a_regex) + : DeathTestImpl(a_statement, a_regex), child_pid_(-1) {} // Waits for the child in a death test to exit, returning its exit @@ -718,18 +718,18 @@ int ForkingDeathTest::Wait() { ReadAndInterpretStatusByte(); - int status; - GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status, 0)); - set_status(status); - return status; + int status_value; + GTEST_DEATH_TEST_CHECK_SYSCALL_(waitpid(child_pid_, &status_value, 0)); + set_status(status_value); + return status_value; } // A concrete death test class that forks, then immediately runs the test // in the child process. class NoExecDeathTest : public ForkingDeathTest { public: - NoExecDeathTest(const char* statement, const RE* regex) : - ForkingDeathTest(statement, regex) { } + NoExecDeathTest(const char* a_statement, const RE* a_regex) : + ForkingDeathTest(a_statement, a_regex) { } virtual TestRole AssumeRole(); }; @@ -782,9 +782,9 @@ DeathTest::TestRole NoExecDeathTest::AssumeRole() { // only this specific death test to be run. class ExecDeathTest : public ForkingDeathTest { public: - ExecDeathTest(const char* statement, const RE* regex, + ExecDeathTest(const char* a_statement, const RE* a_regex, const char* file, int line) : - ForkingDeathTest(statement, regex), file_(file), line_(line) { } + ForkingDeathTest(a_statement, a_regex), file_(file), line_(line) { } virtual TestRole AssumeRole(); private: // The name of the file in which the death test is located. diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index 45a4c105..596dc553 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -902,15 +902,15 @@ class UnitTestImpl { #endif // GTEST_HAS_PARAM_TEST // Sets the TestCase object for the test that's currently running. - void set_current_test_case(TestCase* current_test_case) { - current_test_case_ = current_test_case; + void set_current_test_case(TestCase* a_current_test_case) { + current_test_case_ = a_current_test_case; } // Sets the TestInfo object for the test that's currently running. If // current_test_info is NULL, the assertion results will be stored in // ad_hoc_test_result_. - void set_current_test_info(TestInfo* current_test_info) { - current_test_info_ = current_test_info; + void set_current_test_info(TestInfo* a_current_test_info) { + current_test_info_ = a_current_test_info; } // Registers all parameterized tests defined using TEST_P and diff --git a/src/gtest.cc b/src/gtest.cc index aa50b25b..bd16bc6e 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -2123,14 +2123,14 @@ bool Test::HasNonfatalFailure() { // Constructs a TestInfo object. It assumes ownership of the test factory // object via impl_. -TestInfo::TestInfo(const char* test_case_name, - const char* name, - const char* test_case_comment, - const char* comment, +TestInfo::TestInfo(const char* a_test_case_name, + const char* a_name, + const char* a_test_case_comment, + const char* a_comment, internal::TypeId fixture_class_id, internal::TestFactoryBase* factory) { - impl_ = new internal::TestInfoImpl(this, test_case_name, name, - test_case_comment, comment, + impl_ = new internal::TestInfoImpl(this, a_test_case_name, a_name, + a_test_case_comment, a_comment, fixture_class_id, factory); } @@ -2368,11 +2368,11 @@ int TestCase::total_test_count() const { // name: name of the test case // set_up_tc: pointer to the function that sets up the test case // tear_down_tc: pointer to the function that tears down the test case -TestCase::TestCase(const char* name, const char* comment, +TestCase::TestCase(const char* a_name, const char* a_comment, Test::SetUpTestCaseFunc set_up_tc, Test::TearDownTestCaseFunc tear_down_tc) - : name_(name), - comment_(comment), + : name_(a_name), + comment_(a_comment), test_info_list_(new internal::Vector<TestInfo*>), test_indices_(new internal::Vector<int>), set_up_tc_(set_up_tc), @@ -4022,8 +4022,9 @@ int UnitTestImpl::RunAllTests() { // Runs the tests only if there was no fatal failure during global // set-up. if (!Test::HasFatalFailure()) { - for (int i = 0; i < total_test_case_count(); i++) { - GetMutableTestCase(i)->Run(); + for (int test_index = 0; test_index < total_test_case_count(); + test_index++) { + GetMutableTestCase(test_index)->Run(); } } @@ -4297,18 +4298,18 @@ void UnitTestImpl::UnshuffleTests() { // TestInfoImpl constructor. The new instance assumes ownership of the test // factory object. TestInfoImpl::TestInfoImpl(TestInfo* parent, - const char* test_case_name, - const char* name, - const char* test_case_comment, - const char* comment, - TypeId fixture_class_id, + const char* a_test_case_name, + const char* a_name, + const char* a_test_case_comment, + const char* a_comment, + TypeId a_fixture_class_id, internal::TestFactoryBase* factory) : parent_(parent), - test_case_name_(String(test_case_name)), - name_(String(name)), - test_case_comment_(String(test_case_comment)), - comment_(String(comment)), - fixture_class_id_(fixture_class_id), + test_case_name_(String(a_test_case_name)), + name_(String(a_name)), + test_case_comment_(String(a_test_case_comment)), + comment_(String(a_comment)), + fixture_class_id_(a_fixture_class_id), should_run_(false), is_disabled_(false), matches_filter_(false), |