Small readability improvements in Parser

Also add a test for a parser with no data
This commit is contained in:
Igor [hyperxor]
2019-11-23 22:17:02 +03:00
committed by Jesse Beder
parent 72f699f5ce
commit 5b3e30bfe9
3 changed files with 24 additions and 13 deletions

View File

@@ -1,8 +1,11 @@
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/mark.h"
#include "gmock/gmock.h"
#include <string>
namespace YAML {
class MockEventHandler : public EventHandler {

16
test/parser_test.cpp Normal file
View File

@@ -0,0 +1,16 @@
#include "yaml-cpp/parser.h"
#include "mock_event_handler.h"
#include "gtest/gtest.h"
using YAML::Parser;
using YAML::MockEventHandler;
using ::testing::StrictMock;
TEST(ParserTest, Empty) {
Parser parser;
EXPECT_FALSE(parser);
StrictMock<MockEventHandler> handler;
EXPECT_FALSE(parser.HandleNextDocument(handler));
}