Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
bf9b4b48
"git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "fe186c382905dcf57014985ccea8e067275e9f5f"
Commit
bf9b4b48
authored
Jul 31, 2008
by
shiqian
Browse files
Makes gtest work on Windows Mobile and Symbian. By Mika Raento.
parent
dc6ee0e3
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
200 additions
and
22 deletions
+200
-22
include/gtest/internal/gtest-port.h
include/gtest/internal/gtest-port.h
+9
-0
include/gtest/internal/gtest-string.h
include/gtest/internal/gtest-string.h
+26
-0
src/gtest-death-test.cc
src/gtest-death-test.cc
+2
-0
src/gtest-filepath.cc
src/gtest-filepath.cc
+39
-3
src/gtest-port.cc
src/gtest-port.cc
+15
-2
src/gtest.cc
src/gtest.cc
+45
-15
test/gtest-filepath_test.cc
test/gtest-filepath_test.cc
+36
-0
test/gtest_unittest.cc
test/gtest_unittest.cc
+28
-2
No files found.
include/gtest/internal/gtest-port.h
View file @
bf9b4b48
...
@@ -582,6 +582,15 @@ inline const char* GetEnv(const char* name) {
...
@@ -582,6 +582,15 @@ inline const char* GetEnv(const char* name) {
#endif
#endif
}
}
#ifdef _WIN32_WCE
// Windows CE has no C library. The abort() function is used in
// several places in Google Test. This implementation provides a reasonable
// imitation of standard behaviour.
void
abort
();
#else
inline
void
abort
()
{
::
abort
();
}
#endif // _WIN32_WCE
// Macro for referencing flags.
// Macro for referencing flags.
#define GTEST_FLAG(name) FLAGS_gtest_##name
#define GTEST_FLAG(name) FLAGS_gtest_##name
...
...
include/gtest/internal/gtest-string.h
View file @
bf9b4b48
...
@@ -107,6 +107,32 @@ class String {
...
@@ -107,6 +107,32 @@ class String {
// memory using malloc().
// memory using malloc().
static
const
char
*
CloneCString
(
const
char
*
c_str
);
static
const
char
*
CloneCString
(
const
char
*
c_str
);
#ifdef _WIN32_WCE
// Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
// able to pass strings to Win32 APIs on CE we need to convert them
// to 'Unicode', UTF-16.
// Creates a UTF-16 wide string from the given ANSI string, allocating
// memory using new. The caller is responsible for deleting the return
// value using delete[]. Returns the wide string, or NULL if the
// input is NULL.
//
// The wide string is created using the ANSI codepage (CP_ACP) to
// match the behaviour of the ANSI versions of Win32 calls and the
// C runtime.
static
LPCWSTR
AnsiToUtf16
(
const
char
*
c_str
);
// Creates an ANSI string from the given wide string, allocating
// memory using new. The caller is responsible for deleting the return
// value using delete[]. Returns the ANSI string, or NULL if the
// input is NULL.
//
// The returned string is created using the ANSI codepage (CP_ACP) to
// match the behaviour of the ANSI versions of Win32 calls and the
// C runtime.
static
const
char
*
Utf16ToAnsi
(
LPCWSTR
utf16_str
);
#endif
// Compares two C strings. Returns true iff they have the same content.
// Compares two C strings. Returns true iff they have the same content.
//
//
// Unlike strcmp(), this function can handle NULL argument(s). A
// Unlike strcmp(), this function can handle NULL argument(s). A
...
...
src/gtest-death-test.cc
View file @
bf9b4b48
...
@@ -34,9 +34,11 @@
...
@@ -34,9 +34,11 @@
#include <gtest/gtest-death-test.h>
#include <gtest/gtest-death-test.h>
#include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-port.h>
#ifdef GTEST_HAS_DEATH_TEST
#include <errno.h>
#include <errno.h>
#include <limits.h>
#include <limits.h>
#include <stdarg.h>
#include <stdarg.h>
#endif // GTEST_HAS_DEATH_TEST
#include <gtest/gtest-message.h>
#include <gtest/gtest-message.h>
#include <gtest/internal/gtest-string.h>
#include <gtest/internal/gtest-string.h>
...
...
src/gtest-filepath.cc
View file @
bf9b4b48
...
@@ -32,12 +32,15 @@
...
@@ -32,12 +32,15 @@
#include <gtest/internal/gtest-filepath.h>
#include <gtest/internal/gtest-filepath.h>
#include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-port.h>
#ifdef _WIN32
#ifdef _WIN32_WCE
#include <windows.h>
#elif defined(_WIN32)
#include <direct.h>
#include <direct.h>
#include <io.h>
#include <io.h>
#endif // _WIN32
#include <sys/stat.h>
#include <sys/stat.h>
#else
#include <sys/stat.h>
#endif // _WIN32_WCE or _WIN32
#include <gtest/internal/gtest-string.h>
#include <gtest/internal/gtest-string.h>
...
@@ -47,7 +50,16 @@ namespace internal {
...
@@ -47,7 +50,16 @@ namespace internal {
#ifdef GTEST_OS_WINDOWS
#ifdef GTEST_OS_WINDOWS
const
char
kPathSeparator
=
'\\'
;
const
char
kPathSeparator
=
'\\'
;
const
char
kPathSeparatorString
[]
=
"
\\
"
;
const
char
kPathSeparatorString
[]
=
"
\\
"
;
#ifdef _WIN32_WCE
// Windows CE doesn't have a current directory. You should not use
// the current directory in tests on Windows CE, but this at least
// provides a reasonable fallback.
const
char
kCurrentDirectoryString
[]
=
"
\\
"
;
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
const
DWORD
kInvalidFileAttributes
=
0xffffffff
;
#else
const
char
kCurrentDirectoryString
[]
=
".
\\
"
;
const
char
kCurrentDirectoryString
[]
=
".
\\
"
;
#endif // _WIN32_WCE
#else
#else
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparator
=
'/'
;
const
char
kPathSeparatorString
[]
=
"/"
;
const
char
kPathSeparatorString
[]
=
"/"
;
...
@@ -112,8 +124,15 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
...
@@ -112,8 +124,15 @@ FilePath FilePath::MakeFileName(const FilePath& directory,
// either a file, directory, or whatever.
// either a file, directory, or whatever.
bool
FilePath
::
FileOrDirectoryExists
()
const
{
bool
FilePath
::
FileOrDirectoryExists
()
const
{
#ifdef GTEST_OS_WINDOWS
#ifdef GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
LPCWSTR
unicode
=
String
::
AnsiToUtf16
(
pathname_
.
c_str
());
const
DWORD
attributes
=
GetFileAttributes
(
unicode
);
delete
[]
unicode
;
return
attributes
!=
kInvalidFileAttributes
;
#else
struct
_stat
file_stat
=
{};
struct
_stat
file_stat
=
{};
return
_stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
;
return
_stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
;
#endif // _WIN32_WCE
#else
#else
struct
stat
file_stat
=
{};
struct
stat
file_stat
=
{};
return
stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
;
return
stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
;
...
@@ -126,9 +145,19 @@ bool FilePath::DirectoryExists() const {
...
@@ -126,9 +145,19 @@ bool FilePath::DirectoryExists() const {
bool
result
=
false
;
bool
result
=
false
;
#ifdef _WIN32
#ifdef _WIN32
FilePath
removed_sep
(
this
->
RemoveTrailingPathSeparator
());
FilePath
removed_sep
(
this
->
RemoveTrailingPathSeparator
());
#ifdef _WIN32_WCE
LPCWSTR
unicode
=
String
::
AnsiToUtf16
(
removed_sep
.
c_str
());
const
DWORD
attributes
=
GetFileAttributes
(
unicode
);
delete
[]
unicode
;
if
((
attributes
!=
kInvalidFileAttributes
)
&&
(
attributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
result
=
true
;
}
#else
struct
_stat
file_stat
=
{};
struct
_stat
file_stat
=
{};
result
=
_stat
(
removed_sep
.
c_str
(),
&
file_stat
)
==
0
&&
result
=
_stat
(
removed_sep
.
c_str
(),
&
file_stat
)
==
0
&&
(
_S_IFDIR
&
file_stat
.
st_mode
)
!=
0
;
(
_S_IFDIR
&
file_stat
.
st_mode
)
!=
0
;
#endif // _WIN32_WCE
#else
#else
struct
stat
file_stat
=
{};
struct
stat
file_stat
=
{};
result
=
stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
&&
result
=
stat
(
pathname_
.
c_str
(),
&
file_stat
)
==
0
&&
...
@@ -185,7 +214,14 @@ bool FilePath::CreateDirectoriesRecursively() const {
...
@@ -185,7 +214,14 @@ bool FilePath::CreateDirectoriesRecursively() const {
// exist. Not named "CreateDirectory" because that's a macro on Windows.
// exist. Not named "CreateDirectory" because that's a macro on Windows.
bool
FilePath
::
CreateFolder
()
const
{
bool
FilePath
::
CreateFolder
()
const
{
#ifdef _WIN32
#ifdef _WIN32
#ifdef _WIN32_WCE
FilePath
removed_sep
(
this
->
RemoveTrailingPathSeparator
());
LPCWSTR
unicode
=
String
::
AnsiToUtf16
(
removed_sep
.
c_str
());
int
result
=
CreateDirectory
(
unicode
,
NULL
)
?
0
:
-
1
;
delete
[]
unicode
;
#else
int
result
=
_mkdir
(
pathname_
.
c_str
());
int
result
=
_mkdir
(
pathname_
.
c_str
());
#endif // !WIN32_WCE
#else
#else
int
result
=
mkdir
(
pathname_
.
c_str
(),
0777
);
int
result
=
mkdir
(
pathname_
.
c_str
(),
0777
);
#endif // _WIN32
#endif // _WIN32
...
...
src/gtest-port.cc
View file @
bf9b4b48
...
@@ -32,16 +32,22 @@
...
@@ -32,16 +32,22 @@
#include <gtest/internal/gtest-port.h>
#include <gtest/internal/gtest-port.h>
#include <limits.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef GTEST_HAS_DEATH_TEST
#ifdef GTEST_HAS_DEATH_TEST
#include <regex.h>
#include <regex.h>
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
#include <stdlib.h>
#include <stdio.h>
#ifdef _WIN32_WCE
#include <windows.h> // For TerminateProcess()
#endif // _WIN32_WCE
#include <gtest/gtest-spi.h>
#include <gtest/gtest-spi.h>
#include <gtest/gtest-message.h>
#include <gtest/gtest-message.h>
#include <gtest/internal/gtest-string.h>
#include <gtest/internal/gtest-string.h>
namespace
testing
{
namespace
testing
{
namespace
internal
{
namespace
internal
{
...
@@ -194,6 +200,13 @@ const ::std::vector<String>& GetArgvs() { return g_argvs; }
...
@@ -194,6 +200,13 @@ const ::std::vector<String>& GetArgvs() { return g_argvs; }
#endif // GTEST_HAS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
#ifdef _WIN32_WCE
void
abort
()
{
DebugBreak
();
TerminateProcess
(
GetCurrentProcess
(),
1
);
}
#endif // _WIN32_WCE
// Returns the name of the environment variable corresponding to the
// Returns the name of the environment variable corresponding to the
// given flag. For example, FlagToEnvVar("foo") will return
// given flag. For example, FlagToEnvVar("foo") will return
// "GTEST_FOO" in the open-source version.
// "GTEST_FOO" in the open-source version.
...
...
src/gtest.cc
View file @
bf9b4b48
...
@@ -235,16 +235,6 @@ static bool ShouldRunTestCase(const TestCase* test_case) {
...
@@ -235,16 +235,6 @@ static bool ShouldRunTestCase(const TestCase* test_case) {
return
test_case
->
should_run
();
return
test_case
->
should_run
();
}
}
#ifdef _WIN32_WCE
// Windows CE has no C library. The abort() function is used in
// several places in Google Test. This implementation provides a reasonable
// imitation of standard behaviour.
static
void
abort
()
{
DebugBreak
();
TerminateProcess
(
GetCurrentProcess
(),
1
);
}
#endif // _WIN32_WCE
// AssertHelper constructor.
// AssertHelper constructor.
AssertHelper
::
AssertHelper
(
TestPartResultType
type
,
const
char
*
file
,
AssertHelper
::
AssertHelper
(
TestPartResultType
type
,
const
char
*
file
,
int
line
,
const
char
*
message
)
int
line
,
const
char
*
message
)
...
@@ -465,7 +455,7 @@ void TestPartResultArray::Append(const TestPartResult& result) {
...
@@ -465,7 +455,7 @@ void TestPartResultArray::Append(const TestPartResult& result) {
const
TestPartResult
&
TestPartResultArray
::
GetTestPartResult
(
int
index
)
const
{
const
TestPartResult
&
TestPartResultArray
::
GetTestPartResult
(
int
index
)
const
{
if
(
index
<
0
||
index
>=
size
())
{
if
(
index
<
0
||
index
>=
size
())
{
printf
(
"
\n
Invalid index (%d) into TestPartResultArray.
\n
"
,
index
);
printf
(
"
\n
Invalid index (%d) into TestPartResultArray.
\n
"
,
index
);
abort
();
internal
::
abort
();
}
}
const
internal
::
ListNode
<
TestPartResult
>*
p
=
list_
->
Head
();
const
internal
::
ListNode
<
TestPartResult
>*
p
=
list_
->
Head
();
...
@@ -739,6 +729,42 @@ const char * String::CloneCString(const char* c_str) {
...
@@ -739,6 +729,42 @@ const char * String::CloneCString(const char* c_str) {
NULL
:
CloneString
(
c_str
,
strlen
(
c_str
));
NULL
:
CloneString
(
c_str
,
strlen
(
c_str
));
}
}
#ifdef _WIN32_WCE
// Creates a UTF-16 wide string from the given ANSI string, allocating
// memory using new. The caller is responsible for deleting the return
// value using delete[]. Returns the wide string, or NULL if the
// input is NULL.
LPCWSTR
String
::
AnsiToUtf16
(
const
char
*
ansi
)
{
if
(
!
ansi
)
return
NULL
;
const
int
length
=
strlen
(
ansi
);
const
int
unicode_length
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ansi
,
length
,
NULL
,
0
);
WCHAR
*
unicode
=
new
WCHAR
[
unicode_length
+
1
];
MultiByteToWideChar
(
CP_ACP
,
0
,
ansi
,
length
,
unicode
,
unicode_length
);
unicode
[
unicode_length
]
=
0
;
return
unicode
;
}
// Creates an ANSI string from the given wide string, allocating
// memory using new. The caller is responsible for deleting the return
// value using delete[]. Returns the ANSI string, or NULL if the
// input is NULL.
const
char
*
String
::
Utf16ToAnsi
(
LPCWSTR
utf16_str
)
{
if
(
!
utf16_str
)
return
NULL
;
const
int
ansi_length
=
WideCharToMultiByte
(
CP_ACP
,
0
,
utf16_str
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
char
*
ansi
=
new
char
[
ansi_length
+
1
];
WideCharToMultiByte
(
CP_ACP
,
0
,
utf16_str
,
-
1
,
ansi
,
ansi_length
,
NULL
,
NULL
);
ansi
[
ansi_length
]
=
0
;
return
ansi
;
}
#endif // _WIN32_WCE
// Compares two C strings. Returns true iff they have the same content.
// Compares two C strings. Returns true iff they have the same content.
//
//
// Unlike strcmp(), this function can handle NULL argument(s). A NULL
// Unlike strcmp(), this function can handle NULL argument(s). A NULL
...
@@ -2193,7 +2219,7 @@ enum GTestColor {
...
@@ -2193,7 +2219,7 @@ enum GTestColor {
COLOR_YELLOW
COLOR_YELLOW
};
};
#ifdef
_WIN32
#if
def
ined(_WIN32) && !defined(
_WIN32
_WCE)
// Returns the character attribute for the given color.
// Returns the character attribute for the given color.
WORD
GetColorAttribute
(
GTestColor
color
)
{
WORD
GetColorAttribute
(
GTestColor
color
)
{
...
@@ -2217,7 +2243,7 @@ const char* GetAnsiColorCode(GTestColor color) {
...
@@ -2217,7 +2243,7 @@ const char* GetAnsiColorCode(GTestColor color) {
return
NULL
;
return
NULL
;
}
}
#endif // _WIN32
#endif // _WIN32
&& !_WIN32_WCE
// Returns true iff Google Test should use colors in the output.
// Returns true iff Google Test should use colors in the output.
bool
ShouldUseColor
(
bool
stdout_is_tty
)
{
bool
ShouldUseColor
(
bool
stdout_is_tty
)
{
...
@@ -2256,7 +2282,11 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
...
@@ -2256,7 +2282,11 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_list
args
;
va_list
args
;
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
#ifdef _WIN32_WCE
static
const
bool
use_color
=
false
;
#else
static
const
bool
use_color
=
ShouldUseColor
(
isatty
(
fileno
(
stdout
))
!=
0
);
static
const
bool
use_color
=
ShouldUseColor
(
isatty
(
fileno
(
stdout
))
!=
0
);
#endif // !_WIN32_WCE
// The '!= 0' comparison is necessary to satisfy MSVC 7.1.
// The '!= 0' comparison is necessary to satisfy MSVC 7.1.
if
(
!
use_color
)
{
if
(
!
use_color
)
{
...
@@ -2265,7 +2295,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
...
@@ -2265,7 +2295,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
return
;
return
;
}
}
#ifdef
_WIN32
#if
def
ined(_WIN32) && !defined(
_WIN32
_WCE)
const
HANDLE
stdout_handle
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
const
HANDLE
stdout_handle
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
// Gets the current text color.
// Gets the current text color.
...
@@ -2283,7 +2313,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
...
@@ -2283,7 +2313,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
printf
(
"
\033
[0;3%sm"
,
GetAnsiColorCode
(
color
));
printf
(
"
\033
[0;3%sm"
,
GetAnsiColorCode
(
color
));
vprintf
(
fmt
,
args
);
vprintf
(
fmt
,
args
);
printf
(
"
\033
[m"
);
// Resets the terminal to default.
printf
(
"
\033
[m"
);
// Resets the terminal to default.
#endif // _WIN32
#endif // _WIN32
&& !_WIN32_WCE
va_end
(
args
);
va_end
(
args
);
}
}
...
...
test/gtest-filepath_test.cc
View file @
bf9b4b48
...
@@ -51,7 +51,11 @@
...
@@ -51,7 +51,11 @@
#undef GTEST_IMPLEMENTATION
#undef GTEST_IMPLEMENTATION
#ifdef GTEST_OS_WINDOWS
#ifdef GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
#include <windows.h>
#else
#include <direct.h>
#include <direct.h>
#endif // _WIN32_WCE
#define PATH_SEP "\\"
#define PATH_SEP "\\"
#else
#else
#define PATH_SEP "/"
#define PATH_SEP "/"
...
@@ -61,6 +65,32 @@ namespace testing {
...
@@ -61,6 +65,32 @@ namespace testing {
namespace
internal
{
namespace
internal
{
namespace
{
namespace
{
#ifdef _WIN32_WCE
// Windows CE doesn't have the remove C function.
int
remove
(
const
char
*
path
)
{
LPCWSTR
wpath
=
String
::
AnsiToUtf16
(
path
);
int
ret
=
DeleteFile
(
wpath
)
?
0
:
-
1
;
delete
[]
wpath
;
return
ret
;
}
// Windows CE doesn't have the _rmdir C function.
int
_rmdir
(
const
char
*
path
)
{
FilePath
filepath
(
path
);
LPCWSTR
wpath
=
String
::
AnsiToUtf16
(
filepath
.
RemoveTrailingPathSeparator
().
c_str
());
int
ret
=
RemoveDirectory
(
wpath
)
?
0
:
-
1
;
delete
[]
wpath
;
return
ret
;
}
#elif defined(GTEST_LINUX_GOOGLE3_MODE)
// Creates a temporary directory and returns its path.
const
char
*
MakeTempDir
()
{
static
char
dir_name
[]
=
"gtest-filepath_test_tmpXXXXXX"
;
return
mkdtemp
(
dir_name
);
}
#endif // _WIN32_WCE
// FilePath's functions used by UnitTestOptions::GetOutputFile.
// FilePath's functions used by UnitTestOptions::GetOutputFile.
// RemoveDirectoryName "" -> ""
// RemoveDirectoryName "" -> ""
...
@@ -102,8 +132,14 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
...
@@ -102,8 +132,14 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
// RemoveFileName "" -> "./"
// RemoveFileName "" -> "./"
TEST
(
RemoveFileNameTest
,
EmptyName
)
{
TEST
(
RemoveFileNameTest
,
EmptyName
)
{
#ifdef _WIN32_WCE
// On Windows CE, we use the root as the current directory.
EXPECT_STREQ
(
PATH_SEP
,
FilePath
(
""
).
RemoveFileName
().
c_str
());
#else
EXPECT_STREQ
(
"."
PATH_SEP
,
EXPECT_STREQ
(
"."
PATH_SEP
,
FilePath
(
""
).
RemoveFileName
().
c_str
());
FilePath
(
""
).
RemoveFileName
().
c_str
());
#endif
}
}
// RemoveFileName "adir/" -> "adir/"
// RemoveFileName "adir/" -> "adir/"
...
...
test/gtest_unittest.cc
View file @
bf9b4b48
...
@@ -295,7 +295,9 @@ TEST(ListTest, InsertAfterNotAtBeginning) {
...
@@ -295,7 +295,9 @@ TEST(ListTest, InsertAfterNotAtBeginning) {
TEST
(
StringTest
,
Constructors
)
{
TEST
(
StringTest
,
Constructors
)
{
// Default ctor.
// Default ctor.
String
s1
;
String
s1
;
EXPECT_EQ
(
NULL
,
s1
.
c_str
());
// We aren't using EXPECT_EQ(NULL, s1.c_str()) because comparing
// pointers with NULL isn't supported on all platforms.
EXPECT_TRUE
(
NULL
==
s1
.
c_str
());
// Implicitly constructs from a C-string.
// Implicitly constructs from a C-string.
String
s2
=
"Hi"
;
String
s2
=
"Hi"
;
...
@@ -442,6 +444,31 @@ TEST(StringTest, ShowWideCStringQuoted) {
...
@@ -442,6 +444,31 @@ TEST(StringTest, ShowWideCStringQuoted) {
String
::
ShowWideCStringQuoted
(
L"foo"
).
c_str
());
String
::
ShowWideCStringQuoted
(
L"foo"
).
c_str
());
}
}
#ifdef _WIN32_WCE
TEST
(
StringTest
,
AnsiAndUtf16Null
)
{
EXPECT_EQ
(
NULL
,
String
::
AnsiToUtf16
(
NULL
));
EXPECT_EQ
(
NULL
,
String
::
Utf16ToAnsi
(
NULL
));
}
TEST
(
StringTest
,
AnsiAndUtf16ConvertBasic
)
{
const
char
*
ansi
=
String
::
Utf16ToAnsi
(
L"str"
);
EXPECT_STREQ
(
"str"
,
ansi
);
delete
[]
ansi
;
const
WCHAR
*
utf16
=
String
::
AnsiToUtf16
(
"str"
);
EXPECT_TRUE
(
wcsncmp
(
L"str"
,
utf16
,
3
)
==
0
);
delete
[]
utf16
;
}
TEST
(
StringTest
,
AnsiAndUtf16ConvertPathChars
)
{
const
char
*
ansi
=
String
::
Utf16ToAnsi
(
L".:
\\
\"
*?"
);
EXPECT_STREQ
(
".:
\\
\"
*?"
,
ansi
);
delete
[]
ansi
;
const
WCHAR
*
utf16
=
String
::
AnsiToUtf16
(
".:
\\
\"
*?"
);
EXPECT_TRUE
(
wcsncmp
(
L".:
\\
\"
*?"
,
utf16
,
3
)
==
0
);
delete
[]
utf16
;
}
#endif // _WIN32_WCE
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
// Tests TestProperty construction.
// Tests TestProperty construction.
...
@@ -2865,7 +2892,6 @@ TEST(StreamableTest, BasicIoManip) {
...
@@ -2865,7 +2892,6 @@ TEST(StreamableTest, BasicIoManip) {
},
"Line 1.
\n
A NUL char
\\
0 in line 2."
);
},
"Line 1.
\n
A NUL char
\\
0 in line 2."
);
}
}
// Tests the macros that haven't been covered so far.
// Tests the macros that haven't been covered so far.
void
AddFailureHelper
(
bool
*
aborted
)
{
void
AddFailureHelper
(
bool
*
aborted
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment