"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googletest/src/gtest-typed-test.cc" between
googletest-release-1.10.0.tar.gz and googletest-release-1.11.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

gtest-typed-test.cc  (googletest-release-1.10.0):gtest-typed-test.cc  (googletest-release-1.11.0)
skipping to change at line 37 skipping to change at line 37
// (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.
#include "gtest/gtest-typed-test.h" #include "gtest/gtest-typed-test.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace testing { namespace testing {
namespace internal { namespace internal {
#if GTEST_HAS_TYPED_TEST_P
// Skips to the first non-space char in str. Returns an empty string if str // Skips to the first non-space char in str. Returns an empty string if str
// contains only whitespace characters. // contains only whitespace characters.
static const char* SkipSpaces(const char* str) { static const char* SkipSpaces(const char* str) {
while (IsSpace(*str)) while (IsSpace(*str))
str++; str++;
return str; return str;
} }
static std::vector<std::string> SplitIntoTestNames(const char* src) { static std::vector<std::string> SplitIntoTestNames(const char* src) {
std::vector<std::string> name_vec; std::vector<std::string> name_vec;
skipping to change at line 60 skipping to change at line 58
for (; src != nullptr; src = SkipComma(src)) { for (; src != nullptr; src = SkipComma(src)) {
name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src))); name_vec.push_back(StripTrailingSpaces(GetPrefixUntilComma(src)));
} }
return name_vec; return name_vec;
} }
// Verifies that registered_tests match the test names in // Verifies that registered_tests match the test names in
// registered_tests_; returns registered_tests if successful, or // registered_tests_; returns registered_tests if successful, or
// aborts the program otherwise. // aborts the program otherwise.
const char* TypedTestSuitePState::VerifyRegisteredTestNames( const char* TypedTestSuitePState::VerifyRegisteredTestNames(
const char* file, int line, const char* registered_tests) { const char* test_suite_name, const char* file, int line,
const char* registered_tests) {
RegisterTypeParameterizedTestSuite(test_suite_name, CodeLocation(file, line));
typedef RegisteredTestsMap::const_iterator RegisteredTestIter; typedef RegisteredTestsMap::const_iterator RegisteredTestIter;
registered_ = true; registered_ = true;
std::vector<std::string> name_vec = SplitIntoTestNames(registered_tests); std::vector<std::string> name_vec = SplitIntoTestNames(registered_tests);
Message errors; Message errors;
std::set<std::string> tests; std::set<std::string> tests;
for (std::vector<std::string>::const_iterator name_it = name_vec.begin(); for (std::vector<std::string>::const_iterator name_it = name_vec.begin();
name_it != name_vec.end(); ++name_it) { name_it != name_vec.end(); ++name_it) {
const std::string& name = *name_it; const std::string& name = *name_it;
if (tests.count(name) != 0) { if (tests.count(name) != 0) {
errors << "Test " << name << " is listed more than once.\n"; errors << "Test " << name << " is listed more than once.\n";
continue; continue;
} }
bool found = false; if (registered_tests_.count(name) != 0) {
for (RegisteredTestIter it = registered_tests_.begin();
it != registered_tests_.end();
++it) {
if (name == it->first) {
found = true;
break;
}
}
if (found) {
tests.insert(name); tests.insert(name);
} else { } else {
errors << "No test named " << name errors << "No test named " << name
<< " can be found in this test suite.\n"; << " can be found in this test suite.\n";
} }
} }
for (RegisteredTestIter it = registered_tests_.begin(); for (RegisteredTestIter it = registered_tests_.begin();
it != registered_tests_.end(); it != registered_tests_.end();
++it) { ++it) {
skipping to change at line 114 skipping to change at line 105
if (errors_str != "") { if (errors_str != "") {
fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(), fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
errors_str.c_str()); errors_str.c_str());
fflush(stderr); fflush(stderr);
posix::Abort(); posix::Abort();
} }
return registered_tests; return registered_tests;
} }
#endif // GTEST_HAS_TYPED_TEST_P
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
 End of changes. 4 change blocks. 
16 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)