Home | History | Annotate | Download | only in gtest

Lines Matching defs:string

142 //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string
144 // ::string, which is different to std::string).
145 // GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
258 // string.
261 // string.
279 // StringFromGTestEnv() - parses a string environment variable.
285 #include <string.h>
293 #include <string> // NOLINT
428 // The user told us that ::std::string isn't available.
429 # error "Google Test cannot be used where ::std::string isn't available."
433 // The user didn't tell us whether ::string is available, so we need
1740 class String;
1816 typedef ::string string;
1818 typedef ::std::string string;
1877 // Constructs an RE from a string.
1878 RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
1882 RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
1889 // Returns the string representation of the regex.
1899 static bool FullMatch(const ::std::string& str, const RE& re) {
1902 static bool PartialMatch(const ::std::string& str, const RE& re) {
1908 static bool FullMatch(const ::string& str, const RE& re) {
1911 static bool PartialMatch(const ::string& str, const RE& re) {
1923 // We use a const char* instead of a string, as Google Test may be used
1924 // where string is not available. We also do not use Google Test's own
1925 // String type here, in order to simplify dependencies between the
1946 GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
1951 GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
2104 // GetCapturedStdout - stops capturing stdout and returns the captured string.
2106 // GetCapturedStderr - stops capturing stderr and returns the captured string.
2109 GTEST_API_ String GetCapturedStdout();
2111 GTEST_API_ String GetCapturedStderr();
2119 extern ::std::vector<String> g_argvs;
2121 // GTEST_HAS_DEATH_TEST implies we have ::std::string.
2122 const ::std::vector<String>& GetArgvs();
2708 // empty string rather than unset (NULL). Handle that case.
2810 GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name)
2818 GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val)
2828 // Parses a bool/Int32/string from the environment variable
2847 #include <string.h>
2885 // This header file declares the String class and functions used internally by
2896 // string.h is not guaranteed to provide strcpy on C++ Builder.
2900 #include <string.h>
2902 #include <string>
2907 // String - a UTF-8 string class.
2909 // For historic reasons, we don't use std::string.
2911 // TODO(wan@google.com): replace this class with std::string or
2914 // Note that String can represent both NULL and the empty string,
2915 // while std::string cannot represent NULL.
2917 // NULL and the empty string are considered different. NULL is less
2918 // than anything (including the empty string) except itself.
2922 // string class here.
2925 // std::string on platforms where it cannot be used, we define a copy
2929 // In order to make the representation efficient, the d'tor of String
2930 // is not virtual. Therefore DO NOT INHERIT FROM String.
2931 class GTEST_API_ String {
2939 // This is useful for printing a C string in the syntax of a literal.
2942 static String ShowCStringQuoted(const char* c_str);
2944 // Clones a 0-terminated C string, allocating memory using new. The
2946 // delete[]. Returns the cloned string, or NULL if the input is
2949 // This is different from strdup() in string.h, which allocates
2958 // Creates a UTF-16 wide string from the given ANSI string, allocating
2960 // value using delete[]. Returns the wide string, or NULL if the
2963 // The wide string is created using the ANSI codepage (CP_ACP) to
2968 // Creates an ANSI string from the given wide string, allocating
2970 // value using delete[]. Returns the ANSI string, or NULL if the
2973 // The returned string is created using the ANSI codepage (CP_ACP) to
2982 // NULL C string is considered different to any non-NULL C string,
2983 // including the empty string.
2986 // Converts a wide C string to a String using the UTF-8 encoding.
2988 // the conversion, "(failed to convert from wide string)" is
2990 static String ShowWideCString(const wchar_t* wide_c_str);
2993 // the converted string in double quotes.
2994 static String ShowWideCStringQuoted(const wchar_t* wide_c_str);
3000 // NULL C string is considered different to any non-NULL C string,
3001 // including the empty string.
3008 // A NULL C string is considered different to any non-NULL C string,
3009 // including the empty string.
3017 // A NULL C string is considered different to any non-NULL wide C string,
3018 // including the empty string.
3028 // Formats a list of arguments to a String, using the same format
3029 // spec string as for printf.
3037 static String Format(const char* format, ...);
3041 // The default c'tor constructs a NULL string.
3042 String() : c_str_(NULL), length_(0) {}
3044 // Constructs a String by cloning a 0-terminated C string.
3045 String(const char* a_c_str) { // NOLINT
3054 // Constructs a String by copying a given number of chars from a
3055 // buffer. E.g. String("hello", 3) creates the string "hel",
3056 // String("a\0bcd", 4) creates "a\0bc", String(NULL, 0) creates "",
3057 // and String(NULL, 1) results in access violation.
3058 String(const char* buffer, size_t a_length) {
3062 // The copy c'tor creates a new copy of the string. The two
3063 // String objects do not share content.
3064 String(const String& str) : c_str_(NULL), length_(0) { *this = str; }
3066 // D'tor. String is intended to be a final class, so the d'tor
3068 ~String() { delete[] c_str_; }
3070 // Allows a String to be implicitly converted to an ::std::string or
3071 // ::string, and vice versa. Converting a String containing a NULL
3072 // pointer to ::std::string or ::string is undefined behavior.
3073 // Converting a ::std::string or ::string containing an embedded NUL
3074 // character to a String will result in the prefix up to the first
3076 String(const ::std::string& str) {
3080 operator ::std::string() const { return ::std::string(c_str(), length()); }
3083 String(const ::string& str) {
3087 operator ::string() const { return ::string(c_str(), length()); }
3090 // Returns true iff this is an empty string (i.e. "").
3093 // Compares this with another String.
3096 int Compare(const String& rhs) const;
3098 // Returns true iff this String equals the given C string. A NULL
3099 // string and a non-NULL string are considered not equal.
3102 // Returns true iff this String is less than the given String. A
3103 // NULL string is considered less than "".
3104 bool operator<(const String& rhs) const { return Compare(rhs) < 0; }
3106 // Returns true iff this String doesn't equal the given C string. A NULL
3107 // string and a non-NULL string are considered not equal.
3110 // Returns true iff this String ends with the given suffix. *Any*
3111 // String is considered to end with a NULL or empty suffix.
3114 // Returns true iff this String ends with the given suffix, not considering
3115 // case. Any String is considered to end with a NULL or empty suffix.
3118 // Returns the length of the encapsulated string, or 0 if the
3119 // string is NULL.
3122 // Gets the 0-terminated C string this String object represents.
3123 // The String object still owns the string. Therefore the caller
3127 // Assigns a C string to this object. Self-assignment works.
3128 const String& operator=(const char* a_c_str) {
3129 return *this = String(a_c_str);
3132 // Assigns a String object to this object. Self-assignment works.
3133 const String& operator=(const String& rhs) {
3148 // Constructs a non-NULL String from the given content. This
3150 // ConstructNonNull(NULL, 0) results in an empty string ("").
3162 }; // class String
3164 // Streams a String to an ostream. Each '\0' character in the String
3166 inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
3182 // Gets the content of the stringstream's buffer as a String. Each '\0'
3184 GTEST_API_ String StringStreamToString(::std::stringstream* stream);
3186 // Converts a streamable value to a String. A NULL pointer is
3187 // converted to "(null)". When the input value is a ::string,
3188 // ::std::string, ::wstring, or ::std::wstring object, each NUL
3195 String StreamableToString(const T& streamable);
3267 explicit FilePath(const String& pathname) : pathname_(pathname) {
3280 String ToString() const { return pathname_; }
3317 // the name, otherwise return the name string unmodified.
3403 String pathname_;
3472 String GetTypeName() {
3484 const String name_str(status == 0 ? readable_name : name);
6795 ::std::string PrintToString(const T& value);
6846 GTEST_API_ String AppendUserMessage(const String& gtest_msg,
6868 // Converts a streamable value to a String. A NULL pointer is
6869 // converted to "(null)". When the input value is a ::string,
6870 // ::std::string, ::wstring, or ::std::wstring object, each NUL
6876 String StreamableToString(const T& streamable);
6890 // is a ::std::string or ::string, we print this operand as a C string
6896 inline String FormatForComparisonFailureMessage(\
6901 inline String FormatForComparisonFailureMessage(\
6907 GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)
6909 GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)
6913 GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)
6916 GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
6923 // string/wstring object. In such cases, we just print the operand as
6927 String FormatForComparisonFailureMessage(CharType* GTEST_CREF_WORKAROUND_ p, \
6952 // *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
6956 const String& expected_value,
6957 const String& actual_value,
6961 GTEST_API_ String GetBoolAssertionFailureMessage(
7306 // the entire string if it contains no comma.
7307 inline String GetPrefixUntilComma(const char* str) {
7309 return comma == NULL ? String(str) : String(str, comma - str);
7335 String::Format("%s%s%s/%d", prefix, prefix[0] == '\0' ? "" : "/",
7394 // Returns the current OS stack trace as a String.
7404 GTEST_API_ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test,
8075 static void set_last_death_test_message(const String& message);
8078 // A string containing a description of the outcome of the last death test.
8079 static String last_death_test_message_;
8170 InternalRunDeathTestFlag(const String& a_file,
8182 String file() const { return file_; }
8188 String file_;
8338 // ^ matches the beginning of a string (not that of each line)
8339 // $ matches the end of a string (not that of each line)
8598 // Constructs a Message from a C-string.
8658 // These two overloads allow streaming a wide C string to a Message
8661 return *this << internal::String::ShowWideCString(wide_c_str);
8664 return *this << internal::String::ShowWideCString(wide_c_str);
8668 // Converts the given wide string to a narrow string using the UTF-8
8674 // Converts the given wide string to a narrow string using the UTF-8
8679 // Gets the text streamed to this object so far as a String.
8683 internal::String GetString() const {
9236 // If none of the above is defined, it will print the debug string of
9242 // pointer value and the NUL-terminated string it points to are
9247 // // Prints a value to a string. For a (const or not) char
9248 // // pointer, the NUL-terminated string (but not the pointer) is
9250 // std::string ::testing::PrintToString(const T& value);
9254 // // pointer, the NUL-terminated string (but not the pointer) is
9260 // // pointer and the NUL-terminated string for a (const or not) char pointer.
9263 // // Prints the fields of a tuple tersely to a string vector, one
9266 // std::vector<string> UniversalTersePrintTupleFieldsToStrings(
9287 #include <string>
9326 // We print a protobuf using its ShortDebugString() when the string
9335 const ::testing::internal::string short_str = value.ShortDebugString();
9336 const ::testing::internal::string pretty_str =
9360 // protocol message, its debug string is printed; if it's an enum or
9616 // wchar_t* would cause unsigned short* be printed as a wide string,
9640 // Overloads for ::string and ::std::string.
9642 GTEST_API_ void PrintStringTo(const ::string&s, ::std::ostream* os);
9643 inline void PrintTo(const ::string& s, ::std::ostream* os) {
9648 GTEST_API_ void PrintStringTo(const ::std::string&s, ::std::ostream* os);
9649 inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
9860 // NUL-terminated string (but not the pointer) is printed.
9869 UniversalPrint(string(str), os);
9879 // NUL-terminated string.
9886 typedef ::std::vector<string> Strings;
9907 // Tersely prints the first N fields of a tuple to a string vector,
9958 // Prints the fields of a tuple tersely to a string vector, one
9973 ::std::string PrintToString(const T& value) {
10354 virtual const string& GetTestCaseName() const = 0;
10391 virtual const string& GetTestCaseName() const { return test_case_name_; }
10409 int AddTestCaseInstantiation(const string& instantiation_name,
10428 const string& instantiation_name = gen_it->first;
10467 const string test_case_base_name;
10468 const string test_base_name;
10474 typedef ::std::vector<std::pair<string, GeneratorCreationFunc*> >
10477 const string test_case_name_;
15453 // each with C-string values of "foo", "bar", and "baz":
15461 // ::std::vector< ::std::string> GetParameterStrings() {
15462 // ::std::vector< ::std::string> v;
16761 static internal::String ExtractSummary(const char* message);
16765 internal::String file_name_;
16769 internal::String summary_; // The test failure summary.
16770 internal::String message_; // The test failure message.
17092 // Depending on the platform, different string classes are available.
17093 // On Linux, in addition to ::std::string, Google also makes use of
17094 // class ::string, which has the same interface as ::std::string, but
17098 // ::string is available AND is a distinct type to ::std::string, or
17101 // If the user's ::std::string and ::string are the same class due to
17165 // When this flag is set with a "host:port" string, on supported
17187 const String& message);
17189 // Converts a streamable value to a String. A NULL pointer is
17190 // converted to "(null)". When the input value is a ::string,
17191 // ::std::string, ::wstring, or ::std::wstring object, each NUL
17197 String StreamableToString(const T& streamable) {
17307 // object, returns an empty string.
17333 message_.reset(new ::std::string);
17343 internal::scoped_ptr< ::std::string> message_;
17424 // on platforms where string doesn't compile.
17493 // output as a key/value string pair.
17522 internal::String key_;
17524 internal::String value_;
17692 // For example, *A*:Foo.* is a filter that matches any string that
17739 const std::string test_case_name_; // Test case name
17740 const std::string name_; // Test name
17743 const internal::scoped_ptr<const ::std::string> type_param_;
17746 const internal::scoped_ptr<const ::std::string> value_param_;
17897 internal::String name_;
17900 const internal::scoped_ptr<const ::std::string> type_param_;
18130 // was executed. The UnitTest object owns the string.
18217 const internal::String& message,
18218 const internal::String& os_stack_trace);
18241 const internal::String& message);
18313 // char*, and print it as a C string when it is compared against an
18314 // std::string object, for example.
18322 String FormatForComparisonFailureMessage(const T1& value,
18555 const ::std::string& needle, const ::std::string& haystack);
18558 const ::std::string& needle, const ::std::string& haystack);
18644 String const message;
19285 // C String Comparisons. All tests treat NULL and any non-NULL string
19293 // For wide or narrow string objects, you can use the
19379 // string representation of the error, if available, as well as the