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
83589cca
Commit
83589cca
authored
Mar 05, 2010
by
zhanyong.wan
Browse files
Supports building gtest as a DLL (by Vlad Losev).
parent
542b41e5
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
180 additions
and
110 deletions
+180
-110
CMakeLists.txt
CMakeLists.txt
+48
-9
include/gtest/gtest-death-test.h
include/gtest/gtest-death-test.h
+2
-2
include/gtest/gtest-message.h
include/gtest/gtest-message.h
+1
-1
include/gtest/gtest-spi.h
include/gtest/gtest-spi.h
+2
-2
include/gtest/gtest-test-part.h
include/gtest/gtest-test-part.h
+4
-3
include/gtest/gtest.h
include/gtest/gtest.h
+51
-51
include/gtest/internal/gtest-death-test-internal.h
include/gtest/internal/gtest-death-test-internal.h
+2
-2
include/gtest/internal/gtest-internal.h
include/gtest/internal/gtest-internal.h
+21
-18
include/gtest/internal/gtest-linked_ptr.h
include/gtest/internal/gtest-linked_ptr.h
+1
-1
include/gtest/internal/gtest-param-util.h
include/gtest/internal/gtest-param-util.h
+2
-2
include/gtest/internal/gtest-port.h
include/gtest/internal/gtest-port.h
+30
-9
include/gtest/internal/gtest-string.h
include/gtest/internal/gtest-string.h
+2
-2
src/gtest_main.cc
src/gtest_main.cc
+1
-1
test/gtest_dll_test_.cc
test/gtest_dll_test_.cc
+13
-7
No files found.
CMakeLists.txt
View file @
83589cca
...
@@ -54,10 +54,10 @@ endif()
...
@@ -54,10 +54,10 @@ endif()
#
#
# Defines the gtest & gtest_main libraries. User tests should link
# Defines the gtest & gtest_main libraries. User tests should link
# with one of them.
# with one of them.
function
(
cxx_library_with_type name type cxx_flags
)
function
(
cxx_library name cxx_flags
)
# type can be either STATIC or SHARED to denote a static or shared library.
# ARGN refers to additional arguments after 'cxx_flags'.
# ARGN refers to additional arguments after 'cxx_flags'.
add_library
(
${
name
}
STATIC
${
ARGN
}
)
add_library
(
${
name
}
${
type
}
${
ARGN
}
)
set_target_properties
(
${
name
}
set_target_properties
(
${
name
}
PROPERTIES
PROPERTIES
COMPILE_FLAGS
"
${
cxx_flags
}
"
)
COMPILE_FLAGS
"
${
cxx_flags
}
"
)
...
@@ -66,8 +66,22 @@ function(cxx_library name cxx_flags)
...
@@ -66,8 +66,22 @@ function(cxx_library name cxx_flags)
endif
()
endif
()
endfunction
()
endfunction
()
cxx_library
(
gtest
"
${
cxx_default
}
"
src/gtest-all.cc
)
function
(
cxx_static_library name cxx_flags
)
cxx_library
(
gtest_main
"
${
cxx_default
}
"
src/gtest_main.cc
)
cxx_library_with_type
(
${
name
}
STATIC
"
${
cxx_flags
}
"
${
ARGN
}
)
endfunction
()
function
(
cxx_shared_library name cxx_flags
)
cxx_library_with_type
(
${
name
}
SHARED
"
${
cxx_flags
}
"
${
ARGN
}
)
endfunction
()
function
(
cxx_library name cxx_flags
)
# TODO(vladl@google.com): Make static/shared a user option.
cxx_static_library
(
${
name
}
"
${
cxx_flags
}
"
${
ARGN
}
)
endfunction
()
# Static versions of Google Test libraries.
cxx_static_library
(
gtest
"
${
cxx_default
}
"
src/gtest-all.cc
)
cxx_static_library
(
gtest_main
"
${
cxx_default
}
"
src/gtest_main.cc
)
target_link_libraries
(
gtest_main gtest
)
target_link_libraries
(
gtest_main gtest
)
########################################################################
########################################################################
...
@@ -85,16 +99,22 @@ option(build_gtest_samples "Build gtest's sample programs." OFF)
...
@@ -85,16 +99,22 @@ option(build_gtest_samples "Build gtest's sample programs." OFF)
# creates a named target that depends on the given lib and is built
# creates a named target that depends on the given lib and is built
# from the given source files. dir/name.cc is implicitly included in
# from the given source files. dir/name.cc is implicitly included in
# the source file list.
# the source file list.
function
(
cxx_executable
name dir
lib
)
function
(
cxx_executable
_with_flags name dir cxx_flags
lib
)
add_executable
(
${
name
}
add_executable
(
${
name
}
${
dir
}
/
${
name
}
.cc
${
dir
}
/
${
name
}
.cc
${
ARGN
}
)
${
ARGN
}
)
set_target_properties
(
${
name
}
if
(
cxx_flags
)
PROPERTIES
set_target_properties
(
${
name
}
COMPILE_FLAGS
"
${
cxx_default
}
"
)
PROPERTIES
COMPILE_FLAGS
"
${
cxx_flags
}
"
)
endif
()
target_link_libraries
(
${
name
}
${
lib
}
)
target_link_libraries
(
${
name
}
${
lib
}
)
endfunction
()
endfunction
()
function
(
cxx_executable name dir lib
)
cxx_executable_with_flags
(
${
name
}
${
dir
}
"
${
cxx_default
}
"
${
lib
}
${
ARGN
}
)
endfunction
()
if
(
build_gtest_samples
)
if
(
build_gtest_samples
)
cxx_executable
(
sample1_unittest samples gtest_main samples/sample1.cc
)
cxx_executable
(
sample1_unittest samples gtest_main samples/sample1.cc
)
cxx_executable
(
sample2_unittest samples gtest_main samples/sample2.cc
)
cxx_executable
(
sample2_unittest samples gtest_main samples/sample2.cc
)
...
@@ -207,6 +227,25 @@ if (build_all_gtest_tests)
...
@@ -207,6 +227,25 @@ if (build_all_gtest_tests)
cxx_test_with_flags
(
gtest_no_rtti_unittest
"
${
cxx_no_rtti
}
"
cxx_test_with_flags
(
gtest_no_rtti_unittest
"
${
cxx_no_rtti
}
"
gtest_main_no_rtti test/gtest_unittest.cc
)
gtest_main_no_rtti test/gtest_unittest.cc
)
set
(
cxx_use_shared_gtest
"
${
cxx_default
}
-DGTEST_LINKED_AS_SHARED_LIBRARY=1"
)
set
(
cxx_build_shared_gtest
"
${
cxx_default
}
-DGTEST_CREATE_SHARED_LIBRARY=1"
)
if
(
MSVC
)
# Disables the "class 'X' needs to have dll-interface to be used
# by clients of class 'Y'" warning. This particularly concerns generic
# classes like vector that MS doesn't mark as exported.
set
(
cxx_use_shared_gtest
"
${
cxx_use_shared_gtest
}
-wd4251"
)
set
(
cxx_build_shared_gtest
"
${
cxx_build_shared_gtest
}
-wd4251"
)
endif
()
cxx_shared_library
(
gtest_dll
"
${
cxx_build_shared_gtest
}
"
src/gtest-all.cc
)
# TODO(vladl): This and the next tests may not run in the hermetic
# environment on Windows. Re-evaluate and possibly make them
# platform-conditional after implementing hermetic builds.
cxx_test_with_flags
(
gtest_dll_test_
"
${
cxx_use_shared_gtest
}
"
gtest_dll test/gtest_dll_test_.cc
)
if
(
NOT
(
MSVC
AND
(
MSVC_VERSION EQUAL 1600
)))
if
(
NOT
(
MSVC
AND
(
MSVC_VERSION EQUAL 1600
)))
# The C++ Standard specifies tuple_element<int, class>.
# The C++ Standard specifies tuple_element<int, class>.
# Yet MSVC 10's <utility> declares tuple_element<size_t, class>.
# Yet MSVC 10's <utility> declares tuple_element<size_t, class>.
...
...
include/gtest/gtest-death-test.h
View file @
83589cca
...
@@ -176,7 +176,7 @@ GTEST_DECLARE_string_(death_test_style);
...
@@ -176,7 +176,7 @@ GTEST_DECLARE_string_(death_test_style);
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
// Tests that an exit code describes a normal exit with a given exit code.
// Tests that an exit code describes a normal exit with a given exit code.
class
ExitedWithCode
{
class
GTEST_API_
ExitedWithCode
{
public:
public:
explicit
ExitedWithCode
(
int
exit_code
);
explicit
ExitedWithCode
(
int
exit_code
);
bool
operator
()(
int
exit_status
)
const
;
bool
operator
()(
int
exit_status
)
const
;
...
@@ -190,7 +190,7 @@ class ExitedWithCode {
...
@@ -190,7 +190,7 @@ class ExitedWithCode {
#if !GTEST_OS_WINDOWS
#if !GTEST_OS_WINDOWS
// Tests that an exit code describes an exit due to termination by a
// Tests that an exit code describes an exit due to termination by a
// given signal.
// given signal.
class
KilledBySignal
{
class
GTEST_API_
KilledBySignal
{
public:
public:
explicit
KilledBySignal
(
int
signum
);
explicit
KilledBySignal
(
int
signum
);
bool
operator
()(
int
exit_status
)
const
;
bool
operator
()(
int
exit_status
)
const
;
...
...
include/gtest/gtest-message.h
View file @
83589cca
...
@@ -79,7 +79,7 @@ namespace testing {
...
@@ -79,7 +79,7 @@ namespace testing {
// latter (it causes an access violation if you do). The Message
// latter (it causes an access violation if you do). The Message
// class hides this difference by treating a NULL char pointer as
// class hides this difference by treating a NULL char pointer as
// "(null)".
// "(null)".
class
Message
{
class
GTEST_API_
Message
{
private:
private:
// The type of basic IO manipulators (endl, ends, and flush) for
// The type of basic IO manipulators (endl, ends, and flush) for
// narrow streams.
// narrow streams.
...
...
include/gtest/gtest-spi.h
View file @
83589cca
...
@@ -48,7 +48,7 @@ namespace testing {
...
@@ -48,7 +48,7 @@ namespace testing {
// generated in the same thread that created this object or it can intercept
// generated in the same thread that created this object or it can intercept
// all generated failures. The scope of this mock object can be controlled with
// all generated failures. The scope of this mock object can be controlled with
// the second argument to the two arguments constructor.
// the second argument to the two arguments constructor.
class
ScopedFakeTestPartResultReporter
class
GTEST_API_
ScopedFakeTestPartResultReporter
:
public
TestPartResultReporterInterface
{
:
public
TestPartResultReporterInterface
{
public:
public:
// The two possible mocking modes of this object.
// The two possible mocking modes of this object.
...
@@ -93,7 +93,7 @@ namespace internal {
...
@@ -93,7 +93,7 @@ namespace internal {
// TestPartResultArray contains exactly one failure that has the given
// TestPartResultArray contains exactly one failure that has the given
// type and contains the given substring. If that's not the case, a
// type and contains the given substring. If that's not the case, a
// non-fatal failure will be generated.
// non-fatal failure will be generated.
class
SingleFailureChecker
{
class
GTEST_API_
SingleFailureChecker
{
public:
public:
// The constructor remembers the arguments.
// The constructor remembers the arguments.
SingleFailureChecker
(
const
TestPartResultArray
*
results
,
SingleFailureChecker
(
const
TestPartResultArray
*
results
,
...
...
include/gtest/gtest-test-part.h
View file @
83589cca
...
@@ -44,7 +44,7 @@ namespace testing {
...
@@ -44,7 +44,7 @@ namespace testing {
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
// assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
//
//
// Don't inherit from TestPartResult as its destructor is not virtual.
// Don't inherit from TestPartResult as its destructor is not virtual.
class
TestPartResult
{
class
GTEST_API_
TestPartResult
{
public:
public:
// The possible outcomes of a test part (i.e. an assertion or an
// The possible outcomes of a test part (i.e. an assertion or an
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
// explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
...
@@ -120,7 +120,7 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
...
@@ -120,7 +120,7 @@ std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
//
//
// Don't inherit from TestPartResultArray as its destructor is not
// Don't inherit from TestPartResultArray as its destructor is not
// virtual.
// virtual.
class
TestPartResultArray
{
class
GTEST_API_
TestPartResultArray
{
public:
public:
TestPartResultArray
()
{}
TestPartResultArray
()
{}
...
@@ -155,7 +155,8 @@ namespace internal {
...
@@ -155,7 +155,8 @@ namespace internal {
// reported, it only delegates the reporting to the former result reporter.
// reported, it only delegates the reporting to the former result reporter.
// The original result reporter is restored in the destructor.
// The original result reporter is restored in the destructor.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
class
HasNewFatalFailureHelper
:
public
TestPartResultReporterInterface
{
class
GTEST_API_
HasNewFatalFailureHelper
:
public
TestPartResultReporterInterface
{
public:
public:
HasNewFatalFailureHelper
();
HasNewFatalFailureHelper
();
virtual
~
HasNewFatalFailureHelper
();
virtual
~
HasNewFatalFailureHelper
();
...
...
include/gtest/gtest.h
View file @
83589cca
...
@@ -251,7 +251,7 @@ String StreamableToString(const T& streamable) {
...
@@ -251,7 +251,7 @@ String StreamableToString(const T& streamable) {
// Expected: Foo() is even
// Expected: Foo() is even
// Actual: it's 5
// Actual: it's 5
//
//
class
AssertionResult
{
class
GTEST_API_
AssertionResult
{
public:
public:
// Copy constructor.
// Copy constructor.
// Used in EXPECT_TRUE/FALSE(assertion_result).
// Used in EXPECT_TRUE/FALSE(assertion_result).
...
@@ -306,14 +306,14 @@ AssertionResult& AssertionResult::operator<<(const T& value) {
...
@@ -306,14 +306,14 @@ AssertionResult& AssertionResult::operator<<(const T& value) {
}
}
// Makes a successful assertion result.
// Makes a successful assertion result.
AssertionResult
AssertionSuccess
();
GTEST_API_
AssertionResult
AssertionSuccess
();
// Makes a failed assertion result.
// Makes a failed assertion result.
AssertionResult
AssertionFailure
();
GTEST_API_
AssertionResult
AssertionFailure
();
// Makes a failed assertion result with the given failure message.
// Makes a failed assertion result with the given failure message.
// Deprecated; use AssertionFailure() << msg.
// Deprecated; use AssertionFailure() << msg.
AssertionResult
AssertionFailure
(
const
Message
&
msg
);
GTEST_API_
AssertionResult
AssertionFailure
(
const
Message
&
msg
);
// The abstract class that all tests inherit from.
// The abstract class that all tests inherit from.
//
//
...
@@ -338,7 +338,7 @@ AssertionResult AssertionFailure(const Message& msg);
...
@@ -338,7 +338,7 @@ AssertionResult AssertionFailure(const Message& msg);
// TEST_F(FooTest, Baz) { ... }
// TEST_F(FooTest, Baz) { ... }
//
//
// Test is not copyable.
// Test is not copyable.
class
Test
{
class
GTEST_API_
Test
{
public:
public:
friend
class
internal
::
TestInfoImpl
;
friend
class
internal
::
TestInfoImpl
;
...
@@ -486,7 +486,7 @@ class TestProperty {
...
@@ -486,7 +486,7 @@ class TestProperty {
// the Test.
// the Test.
//
//
// TestResult is not copyable.
// TestResult is not copyable.
class
TestResult
{
class
GTEST_API_
TestResult
{
public:
public:
// Creates an empty TestResult.
// Creates an empty TestResult.
TestResult
();
TestResult
();
...
@@ -604,7 +604,7 @@ class TestResult {
...
@@ -604,7 +604,7 @@ class TestResult {
// The constructor of TestInfo registers itself with the UnitTest
// The constructor of TestInfo registers itself with the UnitTest
// singleton such that the RUN_ALL_TESTS() macro knows which tests to
// singleton such that the RUN_ALL_TESTS() macro knows which tests to
// run.
// run.
class
TestInfo
{
class
GTEST_API_
TestInfo
{
public:
public:
// Destructs a TestInfo object. This function is not virtual, so
// Destructs a TestInfo object. This function is not virtual, so
// don't inherit from TestInfo.
// don't inherit from TestInfo.
...
@@ -686,7 +686,7 @@ class TestInfo {
...
@@ -686,7 +686,7 @@ class TestInfo {
// A test case, which consists of a vector of TestInfos.
// A test case, which consists of a vector of TestInfos.
//
//
// TestCase is not copyable.
// TestCase is not copyable.
class
TestCase
{
class
GTEST_API_
TestCase
{
public:
public:
// Creates a TestCase with the given name.
// Creates a TestCase with the given name.
//
//
...
@@ -924,7 +924,7 @@ class EmptyTestEventListener : public TestEventListener {
...
@@ -924,7 +924,7 @@ class EmptyTestEventListener : public TestEventListener {
};
};
// TestEventListeners lets users add listeners to track events in Google Test.
// TestEventListeners lets users add listeners to track events in Google Test.
class
TestEventListeners
{
class
GTEST_API_
TestEventListeners
{
public:
public:
TestEventListeners
();
TestEventListeners
();
~
TestEventListeners
();
~
TestEventListeners
();
...
@@ -1011,7 +1011,7 @@ class TestEventListeners {
...
@@ -1011,7 +1011,7 @@ class TestEventListeners {
//
//
// This class is thread-safe as long as the methods are called
// This class is thread-safe as long as the methods are called
// according to their specification.
// according to their specification.
class
UnitTest
{
class
GTEST_API_
UnitTest
{
public:
public:
// Gets the singleton UnitTest object. The first time this method
// Gets the singleton UnitTest object. The first time this method
// is called, a UnitTest object is constructed and returned.
// is called, a UnitTest object is constructed and returned.
...
@@ -1198,34 +1198,34 @@ inline Environment* AddGlobalTestEnvironment(Environment* env) {
...
@@ -1198,34 +1198,34 @@ inline Environment* AddGlobalTestEnvironment(Environment* env) {
// updated.
// updated.
//
//
// Calling the function for the second time has no user-visible effect.
// Calling the function for the second time has no user-visible effect.
void
InitGoogleTest
(
int
*
argc
,
char
**
argv
);
GTEST_API_
void
InitGoogleTest
(
int
*
argc
,
char
**
argv
);
// This overloaded version can be used in Windows programs compiled in
// This overloaded version can be used in Windows programs compiled in
// UNICODE mode.
// UNICODE mode.
void
InitGoogleTest
(
int
*
argc
,
wchar_t
**
argv
);
GTEST_API_
void
InitGoogleTest
(
int
*
argc
,
wchar_t
**
argv
);
namespace
internal
{
namespace
internal
{
// These overloaded versions handle ::std::string and ::std::wstring.
// These overloaded versions handle ::std::string and ::std::wstring.
inline
String
FormatForFailureMessage
(
const
::
std
::
string
&
str
)
{
GTEST_API_
inline
String
FormatForFailureMessage
(
const
::
std
::
string
&
str
)
{
return
(
Message
()
<<
'"'
<<
str
<<
'"'
).
GetString
();
return
(
Message
()
<<
'"'
<<
str
<<
'"'
).
GetString
();
}
}
#if GTEST_HAS_STD_WSTRING
#if GTEST_HAS_STD_WSTRING
inline
String
FormatForFailureMessage
(
const
::
std
::
wstring
&
wstr
)
{
GTEST_API_
inline
String
FormatForFailureMessage
(
const
::
std
::
wstring
&
wstr
)
{
return
(
Message
()
<<
"L
\"
"
<<
wstr
<<
'"'
).
GetString
();
return
(
Message
()
<<
"L
\"
"
<<
wstr
<<
'"'
).
GetString
();
}
}
#endif // GTEST_HAS_STD_WSTRING
#endif // GTEST_HAS_STD_WSTRING
// These overloaded versions handle ::string and ::wstring.
// These overloaded versions handle ::string and ::wstring.
#if GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_GLOBAL_STRING
inline
String
FormatForFailureMessage
(
const
::
string
&
str
)
{
GTEST_API_
inline
String
FormatForFailureMessage
(
const
::
string
&
str
)
{
return
(
Message
()
<<
'"'
<<
str
<<
'"'
).
GetString
();
return
(
Message
()
<<
'"'
<<
str
<<
'"'
).
GetString
();
}
}
#endif // GTEST_HAS_GLOBAL_STRING
#endif // GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_GLOBAL_WSTRING
#if GTEST_HAS_GLOBAL_WSTRING
inline
String
FormatForFailureMessage
(
const
::
wstring
&
wstr
)
{
GTEST_API_
inline
String
FormatForFailureMessage
(
const
::
wstring
&
wstr
)
{
return
(
Message
()
<<
"L
\"
"
<<
wstr
<<
'"'
).
GetString
();
return
(
Message
()
<<
"L
\"
"
<<
wstr
<<
'"'
).
GetString
();
}
}
#endif // GTEST_HAS_GLOBAL_WSTRING
#endif // GTEST_HAS_GLOBAL_WSTRING
...
@@ -1391,51 +1391,51 @@ GTEST_IMPL_CMP_HELPER_(GT, > )
...
@@ -1391,51 +1391,51 @@ GTEST_IMPL_CMP_HELPER_(GT, > )
// The helper function for {ASSERT|EXPECT}_STREQ.
// The helper function for {ASSERT|EXPECT}_STREQ.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTREQ
(
const
char
*
expected_expression
,
GTEST_API_
AssertionResult
CmpHelperSTREQ
(
const
char
*
expected_expression
,
const
char
*
actual_expression
,
const
char
*
actual_expression
,
const
char
*
expected
,
const
char
*
expected
,
const
char
*
actual
);
const
char
*
actual
);
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTRCASEEQ
(
const
char
*
expected_expression
,
GTEST_API_
AssertionResult
CmpHelperSTRCASEEQ
(
const
char
*
expected_expression
,
const
char
*
actual_expression
,
const
char
*
actual_expression
,
const
char
*
expected
,
const
char
*
expected
,
const
char
*
actual
);
const
char
*
actual
);
// The helper function for {ASSERT|EXPECT}_STRNE.
// The helper function for {ASSERT|EXPECT}_STRNE.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTRNE
(
const
char
*
s1_expression
,
GTEST_API_
AssertionResult
CmpHelperSTRNE
(
const
char
*
s1_expression
,
const
char
*
s2_expression
,
const
char
*
s2_expression
,
const
char
*
s1
,
const
char
*
s1
,
const
char
*
s2
);
const
char
*
s2
);
// The helper function for {ASSERT|EXPECT}_STRCASENE.
// The helper function for {ASSERT|EXPECT}_STRCASENE.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTRCASENE
(
const
char
*
s1_expression
,
GTEST_API_
AssertionResult
CmpHelperSTRCASENE
(
const
char
*
s1_expression
,
const
char
*
s2_expression
,
const
char
*
s2_expression
,
const
char
*
s1
,
const
char
*
s1
,
const
char
*
s2
);
const
char
*
s2
);
// Helper function for *_STREQ on wide strings.
// Helper function for *_STREQ on wide strings.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTREQ
(
const
char
*
expected_expression
,
GTEST_API_
AssertionResult
CmpHelperSTREQ
(
const
char
*
expected_expression
,
const
char
*
actual_expression
,
const
char
*
actual_expression
,
const
wchar_t
*
expected
,
const
wchar_t
*
expected
,
const
wchar_t
*
actual
);
const
wchar_t
*
actual
);
// Helper function for *_STRNE on wide strings.
// Helper function for *_STRNE on wide strings.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
CmpHelperSTRNE
(
const
char
*
s1_expression
,
GTEST_API_
AssertionResult
CmpHelperSTRNE
(
const
char
*
s1_expression
,
const
char
*
s2_expression
,
const
char
*
s2_expression
,
const
wchar_t
*
s1
,
const
wchar_t
*
s1
,
const
wchar_t
*
s2
);
const
wchar_t
*
s2
);
}
// namespace internal
}
// namespace internal
...
@@ -1513,16 +1513,16 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
...
@@ -1513,16 +1513,16 @@ AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
// Helper function for implementing ASSERT_NEAR.
// Helper function for implementing ASSERT_NEAR.
//
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
AssertionResult
DoubleNearPredFormat
(
const
char
*
expr1
,
GTEST_API_
AssertionResult
DoubleNearPredFormat
(
const
char
*
expr1
,
const
char
*
expr2
,
const
char
*
expr2
,
const
char
*
abs_error_expr
,
const
char
*
abs_error_expr
,
double
val1
,
double
val1
,
double
val2
,
double
val2
,
double
abs_error
);
double
abs_error
);
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// A class that enables one to stream messages to assertion macros
// A class that enables one to stream messages to assertion macros
class
AssertHelper
{
class
GTEST_API_
AssertHelper
{
public:
public:
// Constructor.
// Constructor.
AssertHelper
(
TestPartResult
::
Type
type
,
AssertHelper
(
TestPartResult
::
Type
type
,
...
@@ -1853,10 +1853,10 @@ const T* TestWithParam<T>::parameter_ = NULL;
...
@@ -1853,10 +1853,10 @@ const T* TestWithParam<T>::parameter_ = NULL;
// Asserts that val1 is less than, or almost equal to, val2. Fails
// Asserts that val1 is less than, or almost equal to, val2. Fails
// otherwise. In particular, it fails if either val1 or val2 is NaN.
// otherwise. In particular, it fails if either val1 or val2 is NaN.
AssertionResult
FloatLE
(
const
char
*
expr1
,
const
char
*
expr2
,
GTEST_API_
AssertionResult
FloatLE
(
const
char
*
expr1
,
const
char
*
expr2
,
float
val1
,
float
val2
);
float
val1
,
float
val2
);
AssertionResult
DoubleLE
(
const
char
*
expr1
,
const
char
*
expr2
,
GTEST_API_
AssertionResult
DoubleLE
(
const
char
*
expr1
,
const
char
*
expr2
,
double
val1
,
double
val2
);
double
val1
,
double
val2
);
#if GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
...
...
include/gtest/internal/gtest-death-test-internal.h
View file @
83589cca
...
@@ -64,7 +64,7 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
...
@@ -64,7 +64,7 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
// by wait(2)
// by wait(2)
// exit code: The integer code passed to exit(3), _exit(2), or
// exit code: The integer code passed to exit(3), _exit(2), or
// returned from main()
// returned from main()
class
DeathTest
{
class
GTEST_API_
DeathTest
{
public:
public:
// Create returns false if there was an error determining the
// Create returns false if there was an error determining the
// appropriate action to take for the current death test; for example,
// appropriate action to take for the current death test; for example,
...
@@ -147,7 +147,7 @@ class DefaultDeathTestFactory : public DeathTestFactory {
...
@@ -147,7 +147,7 @@ class DefaultDeathTestFactory : public DeathTestFactory {
// Returns true if exit_status describes a process that was terminated
// Returns true if exit_status describes a process that was terminated
// by a signal, or exited normally with a nonzero exit code.
// by a signal, or exited normally with a nonzero exit code.
bool
ExitedUnsuccessfully
(
int
exit_status
);
GTEST_API_
bool
ExitedUnsuccessfully
(
int
exit_status
);
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
// ASSERT_EXIT*, and EXPECT_EXIT*.
// ASSERT_EXIT*, and EXPECT_EXIT*.
...
...
include/gtest/internal/gtest-internal.h
View file @
83589cca
...
@@ -161,7 +161,7 @@ String AppendUserMessage(const String& gtest_msg,
...
@@ -161,7 +161,7 @@ String AppendUserMessage(const String& gtest_msg,
const
Message
&
user_msg
);
const
Message
&
user_msg
);
// A helper class for creating scoped traces in user programs.
// A helper class for creating scoped traces in user programs.
class
ScopedTrace
{
class
GTEST_API_
ScopedTrace
{
public:
public:
// The c'tor pushes the given source file location and message onto
// The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test.
// a trace stack maintained by Google Test.
...
@@ -240,8 +240,8 @@ inline String FormatForFailureMessage(T* pointer) {
...
@@ -240,8 +240,8 @@ inline String FormatForFailureMessage(T* pointer) {
#endif // GTEST_NEEDS_IS_POINTER_
#endif // GTEST_NEEDS_IS_POINTER_
// These overloaded versions handle narrow and wide characters.
// These overloaded versions handle narrow and wide characters.
String
FormatForFailureMessage
(
char
ch
);
GTEST_API_
String
FormatForFailureMessage
(
char
ch
);
String
FormatForFailureMessage
(
wchar_t
wchar
);
GTEST_API_
String
FormatForFailureMessage
(
wchar_t
wchar
);
// When this operand is a const char* or char*, and the other operand
// When this operand is a const char* or char*, and the other operand
// is a ::std::string or ::string, we print this operand as a C string
// is a ::std::string or ::string, we print this operand as a C string
...
@@ -287,17 +287,18 @@ GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
...
@@ -287,17 +287,18 @@ GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)
// The ignoring_case parameter is true iff the assertion is a
// The ignoring_case parameter is true iff the assertion is a
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// *_STRCASEEQ*. When it's true, the string " (ignoring case)" will
// be inserted into the message.
// be inserted into the message.
AssertionResult
EqFailure
(
const
char
*
expected_expression
,
GTEST_API_
AssertionResult
EqFailure
(
const
char
*
expected_expression
,
const
char
*
actual_expression
,
const
char
*
actual_expression
,
const
String
&
expected_value
,
const
String
&
expected_value
,
const
String
&
actual_value
,
const
String
&
actual_value
,
bool
ignoring_case
);
bool
ignoring_case
);
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
String
GetBoolAssertionFailureMessage
(
const
AssertionResult
&
assertion_result
,
GTEST_API_
String
GetBoolAssertionFailureMessage
(
const
char
*
expression_text
,
const
AssertionResult
&
assertion_result
,
const
char
*
actual_predicate_value
,
const
char
*
expression_text
,
const
char
*
expected_predicate_value
);
const
char
*
actual_predicate_value
,
const
char
*
expected_predicate_value
);
// This template class represents an IEEE floating-point number
// This template class represents an IEEE floating-point number
// (either single-precision or double-precision, depending on the
// (either single-precision or double-precision, depending on the
...
@@ -517,7 +518,7 @@ TypeId GetTypeId() {
...
@@ -517,7 +518,7 @@ TypeId GetTypeId() {
// ::testing::Test, as the latter may give the wrong result due to a
// ::testing::Test, as the latter may give the wrong result due to a
// suspected linker bug when compiling Google Test as a Mac OS X
// suspected linker bug when compiling Google Test as a Mac OS X
// framework.
// framework.
TypeId
GetTestTypeId
();
GTEST_API_
TypeId
GetTestTypeId
();
// Defines the abstract factory interface that creates instances
// Defines the abstract factory interface that creates instances
// of a Test object.
// of a Test object.
...
@@ -550,8 +551,10 @@ class TestFactoryImpl : public TestFactoryBase {
...
@@ -550,8 +551,10 @@ class TestFactoryImpl : public TestFactoryBase {
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
// We pass a long instead of HRESULT to avoid causing an
// We pass a long instead of HRESULT to avoid causing an
// include dependency for the HRESULT type.
// include dependency for the HRESULT type.
AssertionResult
IsHRESULTSuccess
(
const
char
*
expr
,
long
hr
);
// NOLINT
GTEST_API_
AssertionResult
IsHRESULTSuccess
(
const
char
*
expr
,
AssertionResult
IsHRESULTFailure
(
const
char
*
expr
,
long
hr
);
// NOLINT
long
hr
);
// NOLINT
GTEST_API_
AssertionResult
IsHRESULTFailure
(
const
char
*
expr
,
long
hr
);
// NOLINT
#endif // GTEST_OS_WINDOWS
#endif // GTEST_OS_WINDOWS
...
@@ -590,7 +593,7 @@ typedef void (*TearDownTestCaseFunc)();
...
@@ -590,7 +593,7 @@ typedef void (*TearDownTestCaseFunc)();
// factory: pointer to the factory that creates a test object.
// factory: pointer to the factory that creates a test object.
// The newly created TestInfo instance will assume
// The newly created TestInfo instance will assume
// ownership of the factory object.
// ownership of the factory object.
TestInfo
*
MakeAndRegisterTestInfo
(
GTEST_API_
TestInfo
*
MakeAndRegisterTestInfo
(
const
char
*
test_case_name
,
const
char
*
name
,
const
char
*
test_case_name
,
const
char
*
name
,
const
char
*
test_case_comment
,
const
char
*
comment
,
const
char
*
test_case_comment
,
const
char
*
comment
,
TypeId
fixture_class_id
,
TypeId
fixture_class_id
,
...
@@ -606,7 +609,7 @@ bool SkipPrefix(const char* prefix, const char** pstr);
...
@@ -606,7 +609,7 @@ bool SkipPrefix(const char* prefix, const char** pstr);
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// State of the definition of a type-parameterized test case.
// State of the definition of a type-parameterized test case.
class
TypedTestCasePState
{
class
GTEST_API_
TypedTestCasePState
{
public:
public:
TypedTestCasePState
()
:
registered_
(
false
)
{}
TypedTestCasePState
()
:
registered_
(
false
)
{}
...
@@ -753,7 +756,7 @@ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
...
@@ -753,7 +756,7 @@ String GetCurrentOsStackTraceExceptTop(UnitTest* unit_test, int skip_count);
// condition.
// condition.
// Always returns true.
// Always returns true.
bool
AlwaysTrue
();
GTEST_API_
bool
AlwaysTrue
();
// Always returns false.
// Always returns false.
inline
bool
AlwaysFalse
()
{
return
!
AlwaysTrue
();
}
inline
bool
AlwaysFalse
()
{
return
!
AlwaysTrue
();
}
...
...
include/gtest/internal/gtest-linked_ptr.h
View file @
83589cca
...
@@ -77,7 +77,7 @@ namespace testing {
...
@@ -77,7 +77,7 @@ namespace testing {
namespace
internal
{
namespace
internal
{
// Protects copying of all linked_ptr objects.
// Protects copying of all linked_ptr objects.
GTEST_DECLARE_STATIC_MUTEX_
(
g_linked_ptr_mutex
);
GTEST_API_
GTEST_DECLARE_STATIC_MUTEX_
(
g_linked_ptr_mutex
);
// This is used internally by all instances of linked_ptr<>. It needs to be
// This is used internally by all instances of linked_ptr<>. It needs to be
// a non-template class because different types of linked_ptr<> can refer to
// a non-template class because different types of linked_ptr<> can refer to
...
...
include/gtest/internal/gtest-param-util.h
View file @
83589cca
...
@@ -60,8 +60,8 @@ namespace internal {
...
@@ -60,8 +60,8 @@ namespace internal {
// fixture class for the same test case. This may happen when
// fixture class for the same test case. This may happen when
// TEST_P macro is used to define two tests with the same name
// TEST_P macro is used to define two tests with the same name
// but in different namespaces.
// but in different namespaces.
void
ReportInvalidTestCaseType
(
const
char
*
test_case_name
,
GTEST_API_
void
ReportInvalidTestCaseType
(
const
char
*
test_case_name
,
const
char
*
file
,
int
line
);
const
char
*
file
,
int
line
);
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
//
//
...
...
include/gtest/internal/gtest-port.h
View file @
83589cca
...
@@ -66,6 +66,13 @@
...
@@ -66,6 +66,13 @@
// Test's own tr1 tuple implementation should be
// Test's own tr1 tuple implementation should be
// used. Unused when the user sets
// used. Unused when the user sets
// GTEST_HAS_TR1_TUPLE to 0.
// GTEST_HAS_TR1_TUPLE to 0.
// GTEST_LINKED_AS_SHARED_LIBRARY
// - Define to 1 when compiling tests that use
// Google Test as a shared library (known as
// DLL on Windows).
// GTEST_CREATE_SHARED_LIBRARY
// - Define to 1 when compiling Google Test itself
// as a shared library.
// This header defines the following utilities:
// This header defines the following utilities:
//
//
...
@@ -558,6 +565,20 @@
...
@@ -558,6 +565,20 @@
#endif // GTEST_HAS_SEH
#endif // GTEST_HAS_SEH
#ifdef _MSC_VER
#if GTEST_LINKED_AS_SHARED_LIBRARY
#define GTEST_API_ __declspec(dllimport)
#elif GTEST_CREATE_SHARED_LIBRARY
#define GTEST_API_ __declspec(dllexport)
#endif
#endif // _MSC_VER
#ifndef GTEST_API_
#define GTEST_API_
#endif
namespace
testing
{
namespace
testing
{
class
Message
;
class
Message
;
...
@@ -570,7 +591,7 @@ typedef ::std::stringstream StrStream;
...
@@ -570,7 +591,7 @@ typedef ::std::stringstream StrStream;
// A helper for suppressing warnings on constant condition. It just
// A helper for suppressing warnings on constant condition. It just
// returns 'condition'.
// returns 'condition'.
bool
IsTrue
(
bool
condition
);
GTEST_API_
bool
IsTrue
(
bool
condition
);
// Defines scoped_ptr.
// Defines scoped_ptr.
...
@@ -612,7 +633,7 @@ class scoped_ptr {
...
@@ -612,7 +633,7 @@ class scoped_ptr {
// A simple C++ wrapper for <regex.h>. It uses the POSIX Enxtended
// A simple C++ wrapper for <regex.h>. It uses the POSIX Enxtended
// Regular Expression syntax.
// Regular Expression syntax.
class
RE
{
class
GTEST_API_
RE
{
public:
public:
// Constructs an RE from a string.
// Constructs an RE from a string.
RE
(
const
::
std
::
string
&
regex
)
{
Init
(
regex
.
c_str
());
}
// NOLINT
RE
(
const
::
std
::
string
&
regex
)
{
Init
(
regex
.
c_str
());
}
// NOLINT
...
@@ -688,7 +709,7 @@ enum GTestLogSeverity {
...
@@ -688,7 +709,7 @@ enum GTestLogSeverity {
// Formats log entry severity, provides a stream object for streaming the
// Formats log entry severity, provides a stream object for streaming the
// log message, and terminates the message with a newline when going out of
// log message, and terminates the message with a newline when going out of
// scope.
// scope.
class
GTestLog
{
class
GTEST_API_
GTestLog
{
public:
public:
GTestLog
(
GTestLogSeverity
severity
,
const
char
*
file
,
int
line
);
GTestLog
(
GTestLogSeverity
severity
,
const
char
*
file
,
int
line
);
...
@@ -1330,19 +1351,19 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
...
@@ -1330,19 +1351,19 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
#define GTEST_FLAG(name) FLAGS_gtest_##name
#define GTEST_FLAG(name) FLAGS_gtest_##name
// Macros for declaring flags.
// Macros for declaring flags.
#define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name)
#define GTEST_DECLARE_bool_(name)
GTEST_API_
extern bool GTEST_FLAG(name)
#define GTEST_DECLARE_int32_(name) \
#define GTEST_DECLARE_int32_(name) \
extern ::testing::internal::Int32 GTEST_FLAG(name)
GTEST_API_
extern ::testing::internal::Int32 GTEST_FLAG(name)
#define GTEST_DECLARE_string_(name) \
#define GTEST_DECLARE_string_(name) \
extern ::testing::internal::String GTEST_FLAG(name)
GTEST_API_
extern ::testing::internal::String GTEST_FLAG(name)
// Macros for defining flags.
// Macros for defining flags.
#define GTEST_DEFINE_bool_(name, default_val, doc) \
#define GTEST_DEFINE_bool_(name, default_val, doc) \
bool GTEST_FLAG(name) = (default_val)
GTEST_API_
bool GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_int32_(name, default_val, doc) \
#define GTEST_DEFINE_int32_(name, default_val, doc) \
::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
GTEST_API_
::testing::internal::Int32 GTEST_FLAG(name) = (default_val)
#define GTEST_DEFINE_string_(name, default_val, doc) \
#define GTEST_DEFINE_string_(name, default_val, doc) \
::testing::internal::String GTEST_FLAG(name) = (default_val)
GTEST_API_
::testing::internal::String GTEST_FLAG(name) = (default_val)
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
// to *value and returns true; otherwise leaves *value unchanged and returns
// to *value and returns true; otherwise leaves *value unchanged and returns
...
...
include/gtest/internal/gtest-string.h
View file @
83589cca
...
@@ -73,7 +73,7 @@ namespace internal {
...
@@ -73,7 +73,7 @@ namespace internal {
//
//
// In order to make the representation efficient, the d'tor of String
// In order to make the representation efficient, the d'tor of String
// is not virtual. Therefore DO NOT INHERIT FROM String.
// is not virtual. Therefore DO NOT INHERIT FROM String.
class
String
{
class
GTEST_API_
String
{
public:
public:
// Static utility methods
// Static utility methods
...
@@ -326,7 +326,7 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
...
@@ -326,7 +326,7 @@ inline ::std::ostream& operator<<(::std::ostream& os, const String& str) {
// Gets the content of the StrStream's buffer as a String. Each '\0'
// Gets the content of the StrStream's buffer as a String. Each '\0'
// character in the buffer is replaced with "\\0".
// character in the buffer is replaced with "\\0".
String
StrStreamToString
(
StrStream
*
stream
);
GTEST_API_
String
StrStreamToString
(
StrStream
*
stream
);
// Converts a streamable value to a String. A NULL pointer is
// Converts a streamable value to a String. A NULL pointer is
// converted to "(null)". When the input value is a ::string,
// converted to "(null)". When the input value is a ::string,
...
...
src/gtest_main.cc
View file @
83589cca
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
int
main
(
int
argc
,
char
**
argv
)
{
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
std
::
cout
<<
"Running main() from gtest_main.cc
\n
"
;
std
::
cout
<<
"Running main() from gtest_main.cc
\n
"
;
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
...
...
test/gtest_dll_test_.cc
View file @
83589cca
...
@@ -29,21 +29,24 @@
...
@@ -29,21 +29,24 @@
// Author: vladl@google.com (Vlad Losev)
// Author: vladl@google.com (Vlad Losev)
//
//
// Tests for Google Test itself. This verifies that Google Test can be
// Tests for Google Test itself. This verifies that Google Test can be
// linked into an executable successfully when built as a DLL on Windows.
// linked into an executable successfully when built as a shared library (a
// The test is not meant to check the success of test assertions employed in
// DLL on Windows). The test is not meant to check the success of test
// it. It only checks that constructs in them can be successfully linked.
// assertions employed in it. It only checks that constructs in them can be
// successfully linked.
//
//
// If you add new features to Google Test's documented interface, you need to
// If you add new features to Google Test's documented interface, you need to
// add tests exercising them to this file.
// add tests exercising them to this file.
//
//
// If you start having 'unresolved external symbol' linker errors in this file
// If you start having 'unresolved external symbol' linker errors in this file
// after the changes you have made,
re-generate src/gtest.def by running
// after the changes you have made,
you have to modify your source code to
//
scripts/generate_gtest_def.py
.
//
export the new symbols
.
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <gtest/gtest-spi.h>
#include <gtest/gtest-spi.h>
#if GTEST_OS_WINDOWS
#include <windows.h>
#include <windows.h>
#endif
#include <vector>
#include <vector>
using
::
std
::
vector
;
using
::
std
::
vector
;
...
@@ -297,18 +300,20 @@ TEST(FloatingPointComparisonAssertionTest, LinksSuccessfully) {
...
@@ -297,18 +300,20 @@ TEST(FloatingPointComparisonAssertionTest, LinksSuccessfully) {
EXPECT_PRED_FORMAT2
(
::
testing
::
DoubleLE
,
0.0
,
0.001
);
EXPECT_PRED_FORMAT2
(
::
testing
::
DoubleLE
,
0.0
,
0.001
);
}
}
#if GTEST_OS_WINDOWS
// Tests linking of HRESULT assertions.
// Tests linking of HRESULT assertions.
TEST
(
HresultAssertionTest
,
LinksSuccessfully
)
{
TEST
(
HresultAssertionTest
,
LinksSuccessfully
)
{
EXPECT_HRESULT_SUCCEEDED
(
S_OK
);
EXPECT_HRESULT_SUCCEEDED
(
S_OK
);
EXPECT_HRESULT_FAILED
(
E_FAIL
);
EXPECT_HRESULT_FAILED
(
E_FAIL
);
}
}
#endif // GTEST_OS_WINDOWS
#if GTEST_HAS_EXCEPTIONS
#if GTEST_HAS_EXCEPTIONS
// Tests linking of exception assertions.
// Tests linking of exception assertions.
TEST
(
ExceptionAssertionTest
,
LinksSuccessfully
)
{
TEST
(
ExceptionAssertionTest
,
LinksSuccessfully
)
{
EXPECT_THROW
(
throw
1
,
int
);
EXPECT_THROW
(
throw
1
,
int
);
EXPECT_ANY_THROW
(
throw
1
);
EXPECT_ANY_THROW
(
throw
1
);
EXPECT_NO_THROW
(
int
x
=
1
);
EXPECT_NO_THROW
(
std
::
vector
<
int
>
v
);
}
}
#endif // GTEST_HAS_EXCEPTIONS
#endif // GTEST_HAS_EXCEPTIONS
...
@@ -498,6 +503,7 @@ int main(int argc, char **argv) {
...
@@ -498,6 +503,7 @@ int main(int argc, char **argv) {
listener
=
listeners
.
default_result_printer
();
listener
=
listeners
.
default_result_printer
();
listener
=
listeners
.
default_xml_generator
();
listener
=
listeners
.
default_xml_generator
();
RUN_ALL_TESTS
();
int
ret_val
=
RUN_ALL_TESTS
();
static_cast
<
void
>
(
ret_val
);
return
0
;
return
0
;
}
}
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