File tree 2 files changed +35
-2
lines changed
2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -533,7 +533,8 @@ void Emitter::BlockMapPrepareNode(EmitterNodeType::value child) {
533
533
if (m_pState->GetMapKeyFormat () == LongKey)
534
534
m_pState->SetLongKey ();
535
535
if (child == EmitterNodeType::BlockSeq ||
536
- child == EmitterNodeType::BlockMap)
536
+ child == EmitterNodeType::BlockMap ||
537
+ child == EmitterNodeType::Property)
537
538
m_pState->SetLongKey ();
538
539
539
540
if (m_pState->CurGroupLongKey ())
Original file line number Diff line number Diff line change @@ -431,6 +431,38 @@ TEST_F(EmitterTest, BlockMapAsKey) {
431
431
ExpectEmit (" ? key: value\n next key: next value\n : total value" );
432
432
}
433
433
434
+ TEST_F (EmitterTest, TaggedBlockMapAsKey) {
435
+ out << BeginMap;
436
+ out << Key;
437
+ out << LocalTag (" innerMap" );
438
+ out << BeginMap;
439
+ out << Key << " key" << Value << " value" ;
440
+ out << EndMap;
441
+ out << Value;
442
+ out << " outerValue" ;
443
+ out << EndMap;
444
+
445
+ ExpectEmit (R"( ? !innerMap
446
+ key: value
447
+ : outerValue)" );
448
+ }
449
+
450
+ TEST_F (EmitterTest, TaggedBlockListAsKey) {
451
+ out << BeginMap;
452
+ out << Key;
453
+ out << LocalTag (" innerList" );
454
+ out << BeginSeq;
455
+ out << " listItem" ;
456
+ out << EndSeq;
457
+ out << Value;
458
+ out << " outerValue" ;
459
+ out << EndMap;
460
+
461
+ ExpectEmit (R"( ? !innerList
462
+ - listItem
463
+ : outerValue)" );
464
+ }
465
+
434
466
TEST_F (EmitterTest, AliasAndAnchor) {
435
467
out << BeginSeq;
436
468
out << Anchor (" fred" );
@@ -520,7 +552,7 @@ TEST_F(EmitterTest, VerbatimTagInBlockMap) {
520
552
out << Value << VerbatimTag (" !waz" ) << " baz" ;
521
553
out << EndMap;
522
554
523
- ExpectEmit (" !<!foo> bar: !<!waz> baz" );
555
+ ExpectEmit (" ? !<!foo> bar\n : !<!waz> baz" );
524
556
}
525
557
526
558
TEST_F (EmitterTest, VerbatimTagInFlowMap) {
You can’t perform that action at this time.
0 commit comments