Adds support for building Google Mock as a shared library (DLL).
This commit is contained in:
@@ -80,7 +80,7 @@ class CardinalityInterface {
|
||||
// be called. The implementation of Cardinality is just a linked_ptr
|
||||
// to const CardinalityInterface, so copying is fairly cheap.
|
||||
// Don't inherit from Cardinality!
|
||||
class Cardinality {
|
||||
class GTEST_API_ Cardinality {
|
||||
public:
|
||||
// Constructs a null cardinality. Needed for storing Cardinality
|
||||
// objects in STL containers.
|
||||
@@ -122,19 +122,19 @@ class Cardinality {
|
||||
};
|
||||
|
||||
// Creates a cardinality that allows at least n calls.
|
||||
Cardinality AtLeast(int n);
|
||||
GTEST_API_ Cardinality AtLeast(int n);
|
||||
|
||||
// Creates a cardinality that allows at most n calls.
|
||||
Cardinality AtMost(int n);
|
||||
GTEST_API_ Cardinality AtMost(int n);
|
||||
|
||||
// Creates a cardinality that allows any number of calls.
|
||||
Cardinality AnyNumber();
|
||||
GTEST_API_ Cardinality AnyNumber();
|
||||
|
||||
// Creates a cardinality that allows between min and max calls.
|
||||
Cardinality Between(int min, int max);
|
||||
GTEST_API_ Cardinality Between(int min, int max);
|
||||
|
||||
// Creates a cardinality that allows exactly n calls.
|
||||
Cardinality Exactly(int n);
|
||||
GTEST_API_ Cardinality Exactly(int n);
|
||||
|
||||
// Creates a cardinality from its implementation.
|
||||
inline Cardinality MakeCardinality(const CardinalityInterface* c) {
|
||||
|
||||
@@ -268,7 +268,7 @@ class Matcher : public internal::MatcherBase<T> {
|
||||
// instead of Eq(str) and "foo" instead of Eq("foo") when a string
|
||||
// matcher is expected.
|
||||
template <>
|
||||
class Matcher<const internal::string&>
|
||||
class GTEST_API_ Matcher<const internal::string&>
|
||||
: public internal::MatcherBase<const internal::string&> {
|
||||
public:
|
||||
Matcher() {}
|
||||
@@ -285,7 +285,7 @@ class Matcher<const internal::string&>
|
||||
};
|
||||
|
||||
template <>
|
||||
class Matcher<internal::string>
|
||||
class GTEST_API_ Matcher<internal::string>
|
||||
: public internal::MatcherBase<internal::string> {
|
||||
public:
|
||||
Matcher() {}
|
||||
@@ -2548,8 +2548,9 @@ class ElementsAreArrayMatcher {
|
||||
// 'negation' is false; otherwise returns the description of the
|
||||
// negation of the matcher. 'param_values' contains a list of strings
|
||||
// that are the print-out of the matcher's parameters.
|
||||
string FormatMatcherDescription(bool negation, const char* matcher_name,
|
||||
const Strings& param_values);
|
||||
GTEST_API_ string FormatMatcherDescription(bool negation,
|
||||
const char* matcher_name,
|
||||
const Strings& param_values);
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ template <typename F> class FunctionMockerBase;
|
||||
// expectations when InSequence() is used, and thus affect which
|
||||
// expectation gets picked. Therefore, we sequence all mock function
|
||||
// calls to ensure the integrity of the mock objects' states.
|
||||
GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
|
||||
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
|
||||
|
||||
// Untyped base class for ActionResultHolder<R>.
|
||||
class UntypedActionResultHolderBase;
|
||||
@@ -119,7 +119,7 @@ class UntypedActionResultHolderBase;
|
||||
// Abstract base class of FunctionMockerBase. This is the
|
||||
// type-agnostic part of the function mocker interface. Its pure
|
||||
// virtual methods are implemented by FunctionMockerBase.
|
||||
class UntypedFunctionMockerBase {
|
||||
class GTEST_API_ UntypedFunctionMockerBase {
|
||||
public:
|
||||
UntypedFunctionMockerBase();
|
||||
virtual ~UntypedFunctionMockerBase();
|
||||
@@ -363,7 +363,7 @@ enum CallReaction {
|
||||
} // namespace internal
|
||||
|
||||
// Utilities for manipulating mock objects.
|
||||
class Mock {
|
||||
class GTEST_API_ Mock {
|
||||
public:
|
||||
// The following public methods can be called concurrently.
|
||||
|
||||
@@ -471,7 +471,7 @@ class Mock {
|
||||
// ExpectationBase available yet, leading to incorrect destruction
|
||||
// in the linked_ptr (or compilation errors if using a checking
|
||||
// linked_ptr).
|
||||
class Expectation {
|
||||
class GTEST_API_ Expectation {
|
||||
public:
|
||||
// Constructs a null object that doesn't reference any expectation.
|
||||
Expectation();
|
||||
@@ -603,7 +603,7 @@ class ExpectationSet {
|
||||
// Sequence objects are used by a user to specify the relative order
|
||||
// in which the expectations should match. They are copyable (we rely
|
||||
// on the compiler-defined copy constructor and assignment operator).
|
||||
class Sequence {
|
||||
class GTEST_API_ Sequence {
|
||||
public:
|
||||
// Constructs an empty sequence.
|
||||
Sequence() : last_expectation_(new Expectation) {}
|
||||
@@ -644,7 +644,7 @@ class Sequence {
|
||||
// thread. However, for clarity of your tests we recommend you to set
|
||||
// up mocks in the main thread unless you have a good reason not to do
|
||||
// so.
|
||||
class InSequence {
|
||||
class GTEST_API_ InSequence {
|
||||
public:
|
||||
InSequence();
|
||||
~InSequence();
|
||||
@@ -658,7 +658,7 @@ namespace internal {
|
||||
|
||||
// Points to the implicit sequence introduced by a living InSequence
|
||||
// object (if any) in the current thread or NULL.
|
||||
extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
|
||||
GTEST_API_ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
|
||||
|
||||
// Base class for implementing expectations.
|
||||
//
|
||||
@@ -674,7 +674,7 @@ extern ThreadLocal<Sequence*> g_gmock_implicit_sequence;
|
||||
// on the template argument of Expectation to the base class.
|
||||
//
|
||||
// This class is internal and mustn't be used by user code directly.
|
||||
class ExpectationBase {
|
||||
class GTEST_API_ ExpectationBase {
|
||||
public:
|
||||
// source_text is the EXPECT_CALL(...) source that created this Expectation.
|
||||
ExpectationBase(const char* file, int line, const string& source_text);
|
||||
@@ -1222,9 +1222,9 @@ class TypedExpectation : public ExpectationBase {
|
||||
// ::testing::internal and import it into ::testing.
|
||||
|
||||
// Logs a message including file and line number information.
|
||||
void LogWithLocation(testing::internal::LogSeverity severity,
|
||||
const char* file, int line,
|
||||
const string& message);
|
||||
GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
|
||||
const char* file, int line,
|
||||
const string& message);
|
||||
|
||||
template <typename F>
|
||||
class MockSpec {
|
||||
|
||||
@@ -82,11 +82,11 @@ GMOCK_DECLARE_string_(verbose);
|
||||
// Since Google Test is needed for Google Mock to work, this function
|
||||
// also initializes Google Test and parses its flags, if that hasn't
|
||||
// been done.
|
||||
void InitGoogleMock(int* argc, char** argv);
|
||||
GTEST_API_ void InitGoogleMock(int* argc, char** argv);
|
||||
|
||||
// This overloaded version can be used in Windows programs compiled in
|
||||
// UNICODE mode.
|
||||
void InitGoogleMock(int* argc, wchar_t** argv);
|
||||
GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
|
||||
|
||||
} // namespace testing
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace internal {
|
||||
// words. Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
|
||||
// treated as one word. For example, both "FooBar123" and
|
||||
// "foo_bar_123" are converted to "foo bar 123".
|
||||
string ConvertIdentifierNameToWords(const char* id_name);
|
||||
GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name);
|
||||
|
||||
// PointeeOf<Pointer>::type is the type of a value pointed to by a
|
||||
// Pointer, which can be either a smart pointer or a raw pointer. The
|
||||
@@ -271,7 +271,7 @@ class FailureReporterInterface {
|
||||
};
|
||||
|
||||
// Returns the failure reporter used by Google Mock.
|
||||
FailureReporterInterface* GetFailureReporter();
|
||||
GTEST_API_ FailureReporterInterface* GetFailureReporter();
|
||||
|
||||
// Asserts that condition is true; aborts the process with the given
|
||||
// message if condition is false. We cannot use LOG(FATAL) or CHECK()
|
||||
@@ -319,7 +319,7 @@ const char kErrorVerbosity[] = "error";
|
||||
|
||||
// Returns true iff a log with the given severity is visible according
|
||||
// to the --gmock_verbose flag.
|
||||
bool LogIsVisible(LogSeverity severity);
|
||||
GTEST_API_ bool LogIsVisible(LogSeverity severity);
|
||||
|
||||
// Prints the given message to stdout iff 'severity' >= the level
|
||||
// specified by the --gmock_verbose flag. If stack_frames_to_skip >=
|
||||
@@ -328,7 +328,9 @@ bool LogIsVisible(LogSeverity severity);
|
||||
// stack_frames_to_skip is treated as 0, since we don't know which
|
||||
// function calls will be inlined by the compiler and need to be
|
||||
// conservative.
|
||||
void Log(LogSeverity severity, const string& message, int stack_frames_to_skip);
|
||||
GTEST_API_ void Log(LogSeverity severity,
|
||||
const string& message,
|
||||
int stack_frames_to_skip);
|
||||
|
||||
// TODO(wan@google.com): group all type utilities together.
|
||||
|
||||
|
||||
@@ -61,18 +61,18 @@
|
||||
#define GMOCK_FLAG(name) FLAGS_gmock_##name
|
||||
|
||||
// Macros for declaring flags.
|
||||
#define GMOCK_DECLARE_bool_(name) extern bool GMOCK_FLAG(name)
|
||||
#define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
|
||||
#define GMOCK_DECLARE_int32_(name) \
|
||||
extern ::testing::internal::Int32 GMOCK_FLAG(name)
|
||||
extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
|
||||
#define GMOCK_DECLARE_string_(name) \
|
||||
extern ::testing::internal::String GMOCK_FLAG(name)
|
||||
extern GTEST_API_ ::testing::internal::String GMOCK_FLAG(name)
|
||||
|
||||
// Macros for defining flags.
|
||||
#define GMOCK_DEFINE_bool_(name, default_val, doc) \
|
||||
bool GMOCK_FLAG(name) = (default_val)
|
||||
GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
|
||||
#define GMOCK_DEFINE_int32_(name, default_val, doc) \
|
||||
::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
|
||||
GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
|
||||
#define GMOCK_DEFINE_string_(name, default_val, doc) \
|
||||
::testing::internal::String GMOCK_FLAG(name) = (default_val)
|
||||
GTEST_API_ ::testing::internal::String GMOCK_FLAG(name) = (default_val)
|
||||
|
||||
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
|
||||
|
||||
Reference in New Issue
Block a user