This commit is contained in:
Joao Paulo Magalhaes
2024-06-16 13:38:57 +01:00
parent 31d8205d18
commit 8ed7eccb87
9 changed files with 215 additions and 7 deletions

View File

@@ -95,6 +95,18 @@ void test_expected_error_tree_from_yaml(std::string const& parsed_yaml, Location
//-----------------------------------------------------------------------------
// scaffold for WIP:
#if 1
#define ENGINE_TEST_ERRLOC_TMP(name, location, refyaml)
#define ENGINE_TEST_ERR_TMP(name, refyaml)
#define ENGINE_TEST_TMP(name, refyaml, events) template<class Ps> void name(Ps &&ps)
#else
#define ENGINE_TEST_ERRLOC_TMP(name, location, refyaml) ENGINE_TEST_ERRLOC(name, location, refyaml)
#define ENGINE_TEST_ERR_TMP(name, refyaml) ENGINE_TEST_ERR(name, refyaml)
#define ENGINE_TEST_TMP(name, refyaml, events) ENGINE_TEST(name, refyaml, events)
#endif
#define ENGINE_TEST_ERRLOC(name, location, refyaml) \
\
\

View File

@@ -147,6 +147,19 @@ ENGINE_TEST(DocEmptyTerm4_2,
}
ENGINE_TEST_ERRLOC_TMP(TestSuite3HFZ_InvalidContentAfterDocumentEndMarker, Location(1,29),
"---\n"
"key: value\n"
"... invalid\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuite9MQT_01_ScalarDocWithTripleDotInContent, Location(1,29),
"---\n"
"key: value\n"
"... invalid\n"
"")
//-----------------------------------------------------------------------------
ENGINE_TEST(DocEmptyExplMult,

View File

@@ -1553,6 +1553,142 @@ ENGINE_TEST(MapKeyBlock4Ref1,
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
ENGINE_TEST_ERRLOC_TMP(TestSuiteC2SP_ErrImplicitKeysNeedToOnSingleLine, Location(2,2,1),
"[23\n"
"]: 42\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuite7LBH_MultilineDoubleQuotedImplicitKeys, Location(2,2,1),
"\"a\\nb\": 1\n"
"\"c\n"
" d\": 1\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteD49Q_MultilineSingleQuotedImplicitKeys, Location(2,2,1),
"'a\\nb': 1\n"
"'c\n"
" d': 1\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteJKF3_0_MultilineSingleQuotedImplicitKeys, Location(2,2,1),
"\"bar\n"
"bar\": x\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteJKF3_1_MultilineSingleQuotedImplicitKeys, Location(2,2,1),
"- - \"bar\n"
"bar\": x\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteDK4H_ImplicitKeyFollowedByNewline, Location(2,2,1),
"[ key\n"
" : value ]\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteZXT5_ImplicitKeyFollowedByNewlineAndAdjacentValue, Location(2,2,1),
"[ \"key\"\n"
" :value ]\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteVJP3_Err0FlowCollectionsOverManyLines, Location(2,2,1),
"k: {\n"
"k\n"
":\n"
"v\n"
"}\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteVJP3_Err1FlowCollectionsOverManyLines, Location(2,2,1),
"k: {\n"
" k\n"
" :\n"
" v\n"
"}\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteVJP3_Err1FlowCollectionsOverManyLines, Location(2,2,1),
"k: {\n"
" k\n"
" :\n"
" v\n"
"}\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteErrZCZ6, Location(4,2,3),
"a: b: c"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteErrZCZ6, Location(4,2,3),
"a: b: c: d"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteErrZL4Z, Location(4,2,3),
"a: 'b': c"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteErr5U3A_SeqOnSameLineAsKey, Location(2,2,1),
"key: - a\n"
" - b\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteErr4EJS_invalid_tabs, Location(2,2,1),
"a:\n"
"\tb:\n"
"\t\tc: value\n"
"")
ENGINE_TEST_ERRLOC_TMP(ColonPlacementErrNextLine0, Location(2,2,1),
"a\n"
": b\n")
ENGINE_TEST_ERRLOC_TMP(ColonPlacementErrNextLine1, Location(3,2,2),
"a\n"
" : b\n")
ENGINE_TEST_ERRLOC_TMP(ColonPlacementErrNextLine2, Location(4,2,3),
"a\n"
" : b\n")
ENGINE_TEST_TMP(ColonPlacement0,
("a:\n"
" : b\n"
"",
"a:\n"
" : b\n"
""),
"+STR\n"
"+DOC\n"
"+MAP\n"
"=VAL :a\n"
"+MAP\n"
"=VAL :\n"
"=VAL :b\n"
"-MAP\n"
"-MAP\n"
"-DOC\n"
"-STR\n")
{
___(ps.begin_stream());
___(ps.begin_doc());
___(ps.begin_map_val_block());
___(ps.set_key_scalar_plain("a"));
___(ps.begin_map_val_block());
___(ps.set_key_scalar_plain({}));
___(ps.set_val_scalar_plain("b"));
___(ps.end_map());
___(ps.end_map());
___(ps.end_doc());
___(ps.end_stream());
}
} // namespace yml
} // namespace c4

View File

@@ -612,6 +612,20 @@ ENGINE_TEST(SeqMapBlock,
}
ENGINE_TEST_ERRLOC_TMP(TestSuiteYJV2_DashInFlowSequence, Location(1,29),
"[-]\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteG5U8_DashInFlowSequence, Location(1,29),
"- [-, -]\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteCVW2_DashInFlowSequence, Location(1,29),
"[ a, b, c,#invalid\n"
"]\n"
"")
} // namespace yml
} // namespace c4

View File

@@ -1135,6 +1135,13 @@ ENGINE_TEST_ERRLOC(AnchorAndAliasAsBlockSeqVal_SU74, Location(2,10), ""
"[&alias value1,\n"
"&b *alias]\n")
ENGINE_TEST_ERRLOC_TMP(AnchorErrSY6VAnchorBeforeSeqOnSameLine, Location(2,10), ""
"&anchor - sequence entry\n")
ENGINE_TEST_ERRLOC_TMP(AnchorErrCXX2MappingWithAnchorOnDocumentStartLine, Location(2,10), ""
"--- &anchor a: b\n")
} // namespace yml
} // namespace c4

View File

@@ -517,6 +517,11 @@ ENGINE_TEST_ERR(DirectiveMultipleYAML_3,
"---\n"
"bar")
ENGINE_TEST_ERRLOC_TMP(TestSuiteH7TQ_ExtraWordsOnYamlDirective, Location(1,29),
"%YAML 1.2 foo\n"
"---"
"")
} // namespace yml
} // namespace c4

View File

@@ -985,8 +985,7 @@ ENGINE_TEST(QmrkFlow1MapTag,
___(ps.end_stream());
}
#ifdef TODO_FIXME // this is the only failing suite test
ENGINE_TEST(QmrkTestSuiteM2N8_01_0,
ENGINE_TEST_TMP(QmrkTestSuiteM2N8_01_0,
(HAS_CONTAINER_KEYS,
"? []: x"),
"+STR\n"
@@ -1000,8 +999,7 @@ ENGINE_TEST(QmrkTestSuiteM2N8_01_0,
"=VAL :\n"
"-MAP\n"
"-DOC\n"
"-STR\n"
)
"-STR\n")
{
___(ps.begin_stream());
___(ps.begin_doc());
@@ -1017,7 +1015,7 @@ ENGINE_TEST(QmrkTestSuiteM2N8_01_0,
___(ps.end_stream());
}
ENGINE_TEST(QmrkTestSuiteM2N8_01_1,
ENGINE_TEST_TMP(QmrkTestSuiteM2N8_01_1,
(HAS_CONTAINER_KEYS,
"? {}: x"),
"+STR\n"
@@ -1047,7 +1045,6 @@ ENGINE_TEST(QmrkTestSuiteM2N8_01_1,
___(ps.end_doc());
___(ps.end_stream());
}
#endif
} // namespace yml
} // namespace c4

View File

@@ -468,6 +468,26 @@ ENGINE_TEST(PlainScalarFlow0Seq1,
___(ps.end_stream());
}
//-----------------------------------------------------------------------------
ENGINE_TEST_ERRLOC_TMP(TestSuiteS98Z_ErrBlockScalarWithMoreSpacesThanFirstContentLine, Location(1,29),
"empty block scalar: >\n"
" \n"
" \n"
" \n"
"# comment\n")
ENGINE_TEST_ERRLOC_TMP(TestSuiteX4QW_CommentWithoutWhitespaceAfterBlockScalarIndicator, Location(1,29),
"block: ># comment\n"
" scalar\n"
"")
ENGINE_TEST_ERRLOC_TMP(TestSuiteS4GJ_InvalidTextAfterBlockScalarIndicator, Location(1,29),
"folded: > first line\n"
" second line\n"
"")
} // namespace yml
} // namespace c4

View File

@@ -58,6 +58,10 @@ constexpr const AllowedFailure allowed_failures[] = {
_("ZL4Z-error" , "TBD"),
_("ZXT5-error" , "TBD"),
// deliberately tolerated
_("5TRB-error" , "document-end marker in double quoted string"),
_("9MQT_01-error" , "accept scalars with ..."),
//-------------------------------------------------------------------------
// SECTION 2. Deliberate ryml limitations.
@@ -84,7 +88,7 @@ constexpr const AllowedFailure allowed_failures[] = {
// SECTION 3. Problems with the test suite spec. (or our
// understanding of it?)
// malformed json in the test spec
// malformed json in the test spec, cannot be parsed
_("35KP-in_json" , "malformed JSON from multiple documents"),
_("5TYM-in_json" , "malformed JSON from multiple documents"),
_("6XDY-in_json" , "malformed JSON from multiple documents"),