mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Removed old-api tests, added (empty) core spec tests
This commit is contained in:
@@ -31,9 +31,7 @@ namespace YAML
|
||||
|
||||
void Load(std::istream& in);
|
||||
bool HandleNextDocument(EventHandler& eventHandler);
|
||||
|
||||
bool GetNextDocument(Node& document); // old API only
|
||||
|
||||
|
||||
void PrintTokens(std::ostream& out);
|
||||
|
||||
private:
|
||||
|
@@ -3,7 +3,6 @@
|
||||
#include "yaml-cpp/exceptions.h"
|
||||
#include "yaml-cpp/node.h"
|
||||
#include "directives.h"
|
||||
#include "nodebuilder.h"
|
||||
#include "scanner.h"
|
||||
#include "singledocparser.h"
|
||||
#include "tag.h"
|
||||
@@ -55,15 +54,6 @@ namespace YAML
|
||||
return true;
|
||||
}
|
||||
|
||||
// GetNextDocument
|
||||
// . Reads the next document in the queue (of tokens).
|
||||
// . Throws a ParserException on error.
|
||||
bool Parser::GetNextDocument(Node& document)
|
||||
{
|
||||
NodeBuilder builder(document);
|
||||
return HandleNextDocument(builder);
|
||||
}
|
||||
|
||||
// ParseDirectives
|
||||
// . Reads any directives that are next in the queue.
|
||||
void Parser::ParseDirectives()
|
||||
|
@@ -1,8 +1,8 @@
|
||||
file(GLOB test_headers [a-z]*.h)
|
||||
file(GLOB test_sources [a-z]*.cpp)
|
||||
file(GLOB test_old_api_sources old-api/[a-z]*.cpp)
|
||||
file(GLOB test_core_sources core/[a-z]*.cpp)
|
||||
|
||||
list(APPEND test_sources ${test_old_api_sources})
|
||||
list(APPEND test_sources ${test_core_sources})
|
||||
|
||||
include_directories(${YAML_CPP_SOURCE_DIR}/test)
|
||||
|
||||
|
666
test/core/spectests.cpp
Normal file
666
test/core/spectests.cpp
Normal file
@@ -0,0 +1,666 @@
|
||||
#include "spectests.h"
|
||||
|
||||
namespace Test {
|
||||
namespace Spec {
|
||||
// 2.1
|
||||
TEST SeqScalars()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.2
|
||||
TEST MappingScalarsToScalars()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.3
|
||||
TEST MappingScalarsToSequences()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.4
|
||||
TEST SequenceOfMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.5
|
||||
TEST SequenceOfSequences()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.6
|
||||
TEST MappingOfMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.7
|
||||
TEST TwoDocumentsInAStream()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.8
|
||||
TEST PlayByPlayFeed()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.9
|
||||
TEST SingleDocumentWithTwoComments()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.10
|
||||
TEST SimpleAnchor()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.11
|
||||
TEST MappingBetweenSequences()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.12
|
||||
TEST CompactNestedMapping()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.13
|
||||
TEST InLiteralsNewlinesArePreserved()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.14
|
||||
TEST InFoldedScalarsNewlinesBecomeSpaces()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.15
|
||||
TEST FoldedNewlinesArePreservedForMoreIndentedAndBlankLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.16
|
||||
TEST IndentationDeterminesScope()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.17
|
||||
TEST QuotedScalars()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.18
|
||||
TEST MultiLineFlowScalars()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// TODO: 2.19 - 2.22 schema tags
|
||||
|
||||
// 2.23
|
||||
TEST VariousExplicitTags()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.24
|
||||
TEST GlobalTags()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.25
|
||||
TEST UnorderedSets()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.26
|
||||
TEST OrderedMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.27
|
||||
TEST Invoice()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 2.28
|
||||
TEST LogFile()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// TODO: 5.1 - 5.2 BOM
|
||||
|
||||
// 5.3
|
||||
TEST BlockStructureIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.4
|
||||
TEST FlowStructureIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.5
|
||||
TEST CommentIndicator()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.6
|
||||
TEST NodePropertyIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.7
|
||||
TEST BlockScalarIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.8
|
||||
TEST QuotedScalarIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// TODO: 5.9 directive
|
||||
// TODO: 5.10 reserved indicator
|
||||
|
||||
// 5.11
|
||||
TEST LineBreakCharacters()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.12
|
||||
TEST TabsAndSpaces()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.13
|
||||
TEST EscapedCharacters()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 5.14
|
||||
TEST InvalidEscapedCharacters()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.1
|
||||
TEST IndentationSpaces()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.2
|
||||
TEST IndentationIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.3
|
||||
TEST SeparationSpaces()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.4
|
||||
TEST LinePrefixes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.5
|
||||
TEST EmptyLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.6
|
||||
TEST LineFolding()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.7
|
||||
TEST BlockFolding()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.8
|
||||
TEST FlowFolding()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.9
|
||||
TEST SeparatedComment()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.10
|
||||
TEST CommentLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.11
|
||||
TEST MultiLineComments()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.12
|
||||
TEST SeparationSpacesII()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.13
|
||||
TEST ReservedDirectives()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.14
|
||||
TEST YAMLDirective()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.15
|
||||
TEST InvalidRepeatedYAMLDirective()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.16
|
||||
TEST TagDirective()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.17
|
||||
TEST InvalidRepeatedTagDirective()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.18
|
||||
TEST PrimaryTagHandle()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.19
|
||||
TEST SecondaryTagHandle()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.20
|
||||
TEST TagHandles()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.21
|
||||
TEST LocalTagPrefix()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.22
|
||||
TEST GlobalTagPrefix()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.23
|
||||
TEST NodeProperties()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.24
|
||||
TEST VerbatimTags()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.25
|
||||
TEST InvalidVerbatimTags()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.26
|
||||
TEST TagShorthands()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.27
|
||||
TEST InvalidTagShorthands()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.28
|
||||
TEST NonSpecificTags()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 6.29
|
||||
TEST NodeAnchors()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.1
|
||||
TEST AliasNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.2
|
||||
TEST EmptyNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.3
|
||||
TEST CompletelyEmptyNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.4
|
||||
TEST DoubleQuotedImplicitKeys()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.5
|
||||
TEST DoubleQuotedLineBreaks()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.6
|
||||
TEST DoubleQuotedLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.7
|
||||
TEST SingleQuotedCharacters()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.8
|
||||
TEST SingleQuotedImplicitKeys()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.9
|
||||
TEST SingleQuotedLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.10
|
||||
TEST PlainCharacters()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.11
|
||||
TEST PlainImplicitKeys()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.12
|
||||
TEST PlainLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.13
|
||||
TEST FlowSequence()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.14
|
||||
TEST FlowSequenceEntries()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.15
|
||||
TEST FlowMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.16
|
||||
TEST FlowMappingEntries()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.17
|
||||
TEST FlowMappingSeparateValues()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.18
|
||||
TEST FlowMappingAdjacentValues()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.19
|
||||
TEST SinglePairFlowMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.20
|
||||
TEST SinglePairExplicitEntry()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.21
|
||||
TEST SinglePairImplicitEntries()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.22
|
||||
TEST InvalidImplicitKeys()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.23
|
||||
TEST FlowContent()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 7.24
|
||||
TEST FlowNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.1
|
||||
TEST BlockScalarHeader()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.2
|
||||
TEST BlockIndentationHeader()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.3
|
||||
TEST InvalidBlockScalarIndentationIndicators()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.4
|
||||
TEST ChompingFinalLineBreak()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.5
|
||||
TEST ChompingTrailingLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.6
|
||||
TEST EmptyScalarChomping()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.7
|
||||
TEST LiteralScalar()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.8
|
||||
TEST LiteralContent()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.9
|
||||
TEST FoldedScalar()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.10
|
||||
TEST FoldedLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.11
|
||||
TEST MoreIndentedLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.12
|
||||
TEST EmptySeparationLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.13
|
||||
TEST FinalEmptyLines()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.14
|
||||
TEST BlockSequence()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.15
|
||||
TEST BlockSequenceEntryTypes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.16
|
||||
TEST BlockMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.17
|
||||
TEST ExplicitBlockMappingEntries()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.18
|
||||
TEST ImplicitBlockMappingEntries()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.19
|
||||
TEST CompactBlockMappings()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.20
|
||||
TEST BlockNodeTypes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.21
|
||||
TEST BlockScalarNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
|
||||
// 8.22
|
||||
TEST BlockCollectionNodes()
|
||||
{
|
||||
return " not written yet";
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
#include "tests.h"
|
||||
#include "yaml-cpp/yaml.h"
|
||||
#include "yaml-cpp/eventhandler.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace Test
|
||||
@@ -999,6 +1000,21 @@ namespace Test
|
||||
}
|
||||
|
||||
namespace {
|
||||
class NullEventHandler: public YAML::EventHandler {
|
||||
virtual void OnDocumentStart(const YAML::Mark&) {}
|
||||
virtual void OnDocumentEnd() {}
|
||||
|
||||
virtual void OnNull(const YAML::Mark&, YAML::anchor_t) {}
|
||||
virtual void OnAlias(const YAML::Mark&, YAML::anchor_t) {}
|
||||
virtual void OnScalar(const YAML::Mark&, const std::string&, YAML::anchor_t, const std::string&) {}
|
||||
|
||||
virtual void OnSequenceStart(const YAML::Mark&, const std::string&, YAML::anchor_t) {}
|
||||
virtual void OnSequenceEnd() {}
|
||||
|
||||
virtual void OnMapStart(const YAML::Mark&, const std::string&, YAML::anchor_t) {}
|
||||
virtual void OnMapEnd() {}
|
||||
};
|
||||
|
||||
void RunEmitterTest(void (*test)(YAML::Emitter&, std::string&), const std::string& name, int& passed, int& total) {
|
||||
YAML::Emitter out;
|
||||
std::string desiredOutput;
|
||||
@@ -1010,8 +1026,8 @@ namespace Test
|
||||
try {
|
||||
std::stringstream stream(output);
|
||||
YAML::Parser parser;
|
||||
YAML::Node node;
|
||||
parser.GetNextDocument(node);
|
||||
NullEventHandler handler;
|
||||
parser.HandleNextDocument(handler);
|
||||
passed++;
|
||||
} catch(const YAML::Exception& e) {
|
||||
std::cout << "Emitter test failed: " << name << "\n";
|
||||
|
@@ -1,13 +0,0 @@
|
||||
#ifndef NODETESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define NODETESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace Test {
|
||||
bool RunNodeTests();
|
||||
}
|
||||
|
||||
#endif // NODETESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A6666
|
||||
|
@@ -1,13 +0,0 @@
|
||||
#ifndef PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
#define PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
||||
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace Test {
|
||||
bool RunParserTests();
|
||||
}
|
||||
|
||||
#endif // PARSERTESTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||
|
@@ -1,7 +1,5 @@
|
||||
#include "tests.h"
|
||||
#include "emittertests.h"
|
||||
#include "nodetests.h"
|
||||
#include "parsertests.h"
|
||||
#include "spectests.h"
|
||||
#include "yaml-cpp/yaml.h"
|
||||
#include <fstream>
|
||||
@@ -14,9 +12,6 @@ namespace Test
|
||||
void RunAll()
|
||||
{
|
||||
bool passed = true;
|
||||
if(!RunParserTests())
|
||||
passed = false;
|
||||
|
||||
if(!RunEmitterTests())
|
||||
passed = false;
|
||||
|
||||
|
Reference in New Issue
Block a user