Repository navigation
Add tests for YAML 1.2 specification examples - #1493
Open
alex-thiessen-for-siemens wants to merge 43 commits into
Open
alex-thiessen-for-siemens wants to merge 43 commits into
alex-thiessen-for-siemens wants to merge 43 commits into
Conversation
alex-thiessen-for-siemens
force-pushed
the
yaml12-spec-examples
branch
from
September 8, 2026 09:49
53ad40e to
fc28fcd
Compare
alex-thiessen-for-siemens
marked this pull request as ready for review
September 8, 2026 10:05
SGSSGene
requested changes
Sep 8, 2026
alex-thiessen-for-siemens
force-pushed
the
yaml12-spec-examples
branch
from
September 8, 2026 13:58
fc28fcd to
a80652e
Compare
Correct the expected trailing line breaks for Examples 8.5 and 8.21 in both specification test layers. These parser results already match the YAML 1.2.2 examples, so the tests no longer need to be disabled. Reference verification: not applicable. This contribution records YAML 1.2 specification examples. No external semantic oracle is required.
Cover Example 2.19 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 2.20 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 2.21 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 2.22 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.1 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.1 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.2 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.2 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.9 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.9 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.10 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 5.10 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.1 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.1 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.2 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.2 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.3 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.3 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.4 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.4 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.5 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.5 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.6 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 9.6 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.1 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.1 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.2 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.2 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.3 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.3 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.4 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.4 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.5 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.5 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.6 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.6 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.7 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.7 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.8 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.8 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.9 in the event-handler specification test suite and introduce its canonical YAML fixture. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
Cover Example 10.9 in the node specification test suite. Reference verification: not applicable - this contribution records YAML 1.2 specification examples; no external semantic oracle is required.
alex-thiessen-for-siemens
force-pushed
the
yaml12-spec-examples
branch
from
September 20, 2026 10:27
a80652e to
b259845
Compare
SGSSGene
reviewed
Oct 7, 2026
SGSSGene
left a comment
Collaborator
There was a problem hiding this comment.
Thank your for this PR, this is highly appriciated.
To get a better grip on all the changes I added ':+1:` everypart that I agree with.
I did found a few things, to make them find them easier, a list them here explicitly:
- Waiting for resolution of Ex8_21_BlockScalarNodes (or we put a SPEC GAP marker here or similar)
- ex9_1 is not correct
- Unclear if
DISABLED_Ex10_8_JsonTagResolutiontest is correct TEST_F(NodeSpecTest, Ex10_1_MapExamples)not testing everythingTEST(NodeSpecTest, Ex10_2_SequenceExamples)not testing everything
| } | ||
|
|
||
| // TODO: 5.1 - 5.2 BOM | ||
| TEST_F(HandlerSpecTest, Ex5_1_ByteOrderMark) { Parse(ex5_1); } |
Collaborator
There was a problem hiding this comment.
👍 (I will mark every test that I have checked, to keep an overview)
| TEST_F(HandlerSpecTest, Ex5_1_ByteOrderMark) { Parse(ex5_1); } | ||
|
|
||
| TEST_F(HandlerSpecTest, Ex5_2_InvalidByteOrderMark) { | ||
| EXPECT_THROW(IgnoreParse(ex5_2), ParserException); |
Comment on lines
+329
to
+335
| const char *ex5_9 = | ||
| "%YAML 1.2\n" | ||
| "--- text"; | ||
|
|
||
| const char *ex5_10 = | ||
| "commercial-at: @text\n" | ||
| "grave-accent: `text"; |
Comment on lines
+289
to
+296
| const char *ex5_1 = | ||
| "\xEF\xBB\xBF" | ||
| "# Comment only."; | ||
|
|
||
| const char *ex5_2 = | ||
| "- Invalid use of BOM\n" | ||
| "\xEF\xBB\xBF" | ||
| "- Inside a document."; |
Comment on lines
+724
to
+729
| TEST_F(HandlerSpecTest, Ex5_9_DirectiveIndicator) { | ||
| EXPECT_CALL(handler, OnDocumentStart(_)); | ||
| EXPECT_CALL(handler, OnScalar(_, "?", 0, "text")); | ||
| EXPECT_CALL(handler, OnDocumentEnd()); | ||
| Parse(ex5_9); | ||
| } |
Comment on lines
+1258
to
+1263
| TEST(NodeSpecTest, Ex10_5_BooleanExamples) { | ||
| Node doc = Load(ex10_5); | ||
| EXPECT_TRUE(doc["YAML is a superset of JSON"].as<bool>()); | ||
| EXPECT_FALSE(doc["Pluto is a planet"].as<bool>()); | ||
| } | ||
|
|
Comment on lines
+1264
to
+1269
| TEST(NodeSpecTest, Ex10_6_IntegerExamples) { | ||
| Node doc = Load(ex10_6); | ||
| EXPECT_EQ(-12, doc["negative"].as<int>()); | ||
| EXPECT_EQ(0, doc["zero"].as<int>()); | ||
| EXPECT_EQ(34, doc["positive"].as<int>()); | ||
| } |
Comment on lines
+1271
to
+1279
| TEST(NodeSpecTest, Ex10_7_FloatingPointExamples) { | ||
| Node doc = Load(ex10_7); | ||
| EXPECT_DOUBLE_EQ(-1.0, doc["negative"].as<double>()); | ||
| EXPECT_DOUBLE_EQ(0.0, doc["zero"].as<double>()); | ||
| EXPECT_DOUBLE_EQ(23000.0, doc["positive"].as<double>()); | ||
| EXPECT_TRUE(std::isinf(doc["infinity"].as<double>())); | ||
| EXPECT_GT(doc["infinity"].as<double>(), 0.0); | ||
| EXPECT_TRUE(std::isnan(doc["not a number"].as<double>())); | ||
| } |
|
|
||
| TEST(NodeSpecTest, DISABLED_Ex10_8_JsonTagResolution) { | ||
| // SPEC_GAP: yaml-cpp uses the YAML 1.1-compatible resolver for several | ||
| // values that YAML 1.2 JSON resolution leaves as strings. |
Collaborator
There was a problem hiding this comment.
The only real issue here is IsNull isn't it?
because as<bool> could just be as<std::string> as well.
| const char *ex5_1 = | ||
| "\xEF\xBB\xBF" | ||
| "# Comment only."; | ||
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
Closes #38