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
gaoqiong
yaml-cpp
Commits
066b71a7
Commit
066b71a7
authored
Mar 23, 2014
by
Jesse Beder
Browse files
Factored out mock event handler
parent
90d7562b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
36 deletions
+27
-36
test/integration/handler_spec_test.cpp
test/integration/handler_spec_test.cpp
+1
-18
test/integration/handler_test.cpp
test/integration/handler_test.cpp
+1
-18
test/mock_event_handler.h
test/mock_event_handler.h
+25
-0
No files found.
test/integration/handler_spec_test.cpp
View file @
066b71a7
#include "mock_event_handler.h"
#include "specexamples.h" // IWYU pragma: keep
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
...
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
namespace
YAML
{
namespace
{
class
MockEventHandler
:
public
EventHandler
{
public:
MOCK_METHOD1
(
OnDocumentStart
,
void
(
const
Mark
&
));
MOCK_METHOD0
(
OnDocumentEnd
,
void
());
MOCK_METHOD2
(
OnNull
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD2
(
OnAlias
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD4
(
OnScalar
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
,
const
std
::
string
&
));
MOCK_METHOD3
(
OnSequenceStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnSequenceEnd
,
void
());
MOCK_METHOD3
(
OnMapStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnMapEnd
,
void
());
};
class
HandlerSpecTest
:
public
::
testing
::
Test
{
protected:
void
Parse
(
const
std
::
string
&
example
)
{
...
...
test/integration/handler_test.cpp
View file @
066b71a7
#include "mock_event_handler.h"
#include "specexamples.h" // IWYU pragma: keep
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
...
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
namespace
YAML
{
namespace
{
class
MockEventHandler
:
public
EventHandler
{
public:
MOCK_METHOD1
(
OnDocumentStart
,
void
(
const
Mark
&
));
MOCK_METHOD0
(
OnDocumentEnd
,
void
());
MOCK_METHOD2
(
OnNull
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD2
(
OnAlias
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD4
(
OnScalar
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
,
const
std
::
string
&
));
MOCK_METHOD3
(
OnSequenceStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnSequenceEnd
,
void
());
MOCK_METHOD3
(
OnMapStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnMapEnd
,
void
());
};
class
HandlerTest
:
public
::
testing
::
Test
{
protected:
void
Parse
(
const
std
::
string
&
example
)
{
...
...
test/mock_event_handler.h
0 → 100644
View file @
066b71a7
#include "yaml-cpp/eventhandler.h"
#include "gmock/gmock.h"
namespace
YAML
{
class
MockEventHandler
:
public
EventHandler
{
public:
MOCK_METHOD1
(
OnDocumentStart
,
void
(
const
Mark
&
));
MOCK_METHOD0
(
OnDocumentEnd
,
void
());
MOCK_METHOD2
(
OnNull
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD2
(
OnAlias
,
void
(
const
Mark
&
,
anchor_t
));
MOCK_METHOD4
(
OnScalar
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
,
const
std
::
string
&
));
MOCK_METHOD3
(
OnSequenceStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnSequenceEnd
,
void
());
MOCK_METHOD3
(
OnMapStart
,
void
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
));
MOCK_METHOD0
(
OnMapEnd
,
void
());
};
}
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