Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
066b71a7
Commit
066b71a7
authored
Mar 23, 2014
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factored out mock event handler
parent
90d7562b
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
+1
-18
test/integration/handler_test.cpp
+1
-18
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 "specexamples.h" // IWYU pragma: keep
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
namespace
YAML
{
namespace
YAML
{
namespace
{
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
{
class
HandlerSpecTest
:
public
::
testing
::
Test
{
protected
:
protected
:
void
Parse
(
const
std
::
string
&
example
)
{
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 "specexamples.h" // IWYU pragma: keep
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
#include "yaml-cpp/yaml.h" // IWYU pragma: keep
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
...
@@ -22,24 +23,6 @@ using ::testing::StrictMock;
namespace
YAML
{
namespace
YAML
{
namespace
{
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
{
class
HandlerTest
:
public
::
testing
::
Test
{
protected
:
protected
:
void
Parse
(
const
std
::
string
&
example
)
{
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