aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest
diff options
context:
space:
mode:
authorkosak <kosak@google.com>2013-02-22 20:10:40 +0000
committerkosak <kosak@google.com>2013-02-22 20:10:40 +0000
commitcc1fdb58caf8d5ac9b858f615d3c42267fc5e258 (patch)
tree2821e8cd493ff783f47570fe991fc3ceab776ec7 /include/gtest
parent65b5c22436fab922ea791b9b39a8fe154f0849f8 (diff)
downloadgoogletest-cc1fdb58caf8d5ac9b858f615d3c42267fc5e258.tar.gz
googletest-cc1fdb58caf8d5ac9b858f615d3c42267fc5e258.tar.bz2
googletest-cc1fdb58caf8d5ac9b858f615d3c42267fc5e258.zip
Removes testing::internal::String::Format(), which causes problems as it truncates the result at 4096 chars. Also update an obsolete link in comment.
Diffstat (limited to 'include/gtest')
-rw-r--r--include/gtest/gtest.h10
-rw-r--r--include/gtest/internal/gtest-internal.h9
-rw-r--r--include/gtest/internal/gtest-param-util.h8
-rw-r--r--include/gtest/internal/gtest-string.h18
4 files changed, 23 insertions, 22 deletions
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h
index 9ecb1456..09e74d91 100644
--- a/include/gtest/gtest.h
+++ b/include/gtest/gtest.h
@@ -680,7 +680,8 @@ class GTEST_API_ TestInfo {
friend class TestCase;
friend class internal::UnitTestImpl;
friend TestInfo* internal::MakeAndRegisterTestInfo(
- const char* test_case_name, const char* name,
+ const char* test_case_name,
+ const char* name,
const char* type_param,
const char* value_param,
internal::TypeId fixture_class_id,
@@ -690,9 +691,10 @@ class GTEST_API_ TestInfo {
// Constructs a TestInfo object. The newly constructed instance assumes
// ownership of the factory object.
- TestInfo(const char* test_case_name, const char* name,
- const char* a_type_param,
- const char* a_value_param,
+ TestInfo(const std::string& test_case_name,
+ const std::string& name,
+ const char* a_type_param, // NULL if not a type-parameterized test
+ const char* a_value_param, // NULL if not a value-parameterized test
internal::TypeId fixture_class_id,
internal::TestFactoryBase* factory);
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index 4e57d3ca..ca4e1fdb 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -493,7 +493,7 @@ typedef void (*TearDownTestCaseFunc)();
// test_case_name: name of the test case
// name: name of the test
// type_param the name of the test's type parameter, or NULL if
-// this is not a typed or a type-parameterized test.
+// this is not a typed or a type-parameterized test.
// value_param text representation of the test's value parameter,
// or NULL if this is not a type-parameterized test.
// fixture_class_id: ID of the test fixture class
@@ -503,7 +503,8 @@ typedef void (*TearDownTestCaseFunc)();
// The newly created TestInfo instance will assume
// ownership of the factory object.
GTEST_API_ TestInfo* MakeAndRegisterTestInfo(
- const char* test_case_name, const char* name,
+ const char* test_case_name,
+ const char* name,
const char* type_param,
const char* value_param,
TypeId fixture_class_id,
@@ -591,8 +592,8 @@ class TypeParameterizedTest {
// First, registers the first type-parameterized test in the type
// list.
MakeAndRegisterTestInfo(
- String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
- case_name, index).c_str(),
+ (std::string(prefix) + (prefix[0] == '\0' ? "" : "/") + case_name + "/"
+ + StreamableToString(index)).c_str(),
GetPrefixUntilComma(test_names).c_str(),
GetTypeName<Type>().c_str(),
NULL, // No value parameter.
diff --git a/include/gtest/internal/gtest-param-util.h b/include/gtest/internal/gtest-param-util.h
index 0ef9718c..d5e1028b 100644
--- a/include/gtest/internal/gtest-param-util.h
+++ b/include/gtest/internal/gtest-param-util.h
@@ -494,10 +494,10 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
const string& instantiation_name = gen_it->first;
ParamGenerator<ParamType> generator((*gen_it->second)());
- Message test_case_name_stream;
+ string test_case_name;
if ( !instantiation_name.empty() )
- test_case_name_stream << instantiation_name << "/";
- test_case_name_stream << test_info->test_case_base_name;
+ test_case_name = instantiation_name + "/";
+ test_case_name += test_info->test_case_base_name;
int i = 0;
for (typename ParamGenerator<ParamType>::iterator param_it =
@@ -506,7 +506,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase {
Message test_name_stream;
test_name_stream << test_info->test_base_name << "/" << i;
MakeAndRegisterTestInfo(
- test_case_name_stream.GetString().c_str(),
+ test_case_name.c_str(),
test_name_stream.GetString().c_str(),
NULL, // No type parameter.
PrintToString(*param_it).c_str(),
diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h
index 472dd058..7b740858 100644
--- a/include/gtest/internal/gtest-string.h
+++ b/include/gtest/internal/gtest-string.h
@@ -144,16 +144,14 @@ class GTEST_API_ String {
static bool EndsWithCaseInsensitive(
const std::string& str, const std::string& suffix);
- // Formats a list of arguments to an std::string, using the same format
- // spec string as for printf.
- //
- // We do not use the StringPrintf class as it is not universally
- // available.
- //
- // The result is limited to 4096 characters (including the tailing
- // 0). If 4096 characters are not enough to format the input,
- // "<buffer exceeded>" is returned.
- static std::string Format(const char* format, ...);
+ // Formats an int value as "%02d".
+ static std::string FormatIntWidth2(int value); // "%02d" for width == 2
+
+ // Formats an int value as "%X".
+ static std::string FormatHexInt(int value);
+
+ // Formats a byte as "%02X".
+ static std::string FormatByte(unsigned char value);
private:
String(); // Not meant to be instantiated.