@@ -101,7 +101,7 @@ TEST_F(EmitterTest, StringFormat) {
101101 out << " string" ;
102102 out << EndSeq;
103103
104- ExpectEmit (" - 'string'\n - \" string\"\n - |\n string" );
104+ ExpectEmit (" - 'string'\n - \" string\"\n - |- \n string" );
105105}
106106
107107TEST_F (EmitterTest, IntBase) {
@@ -409,7 +409,7 @@ TEST_F(EmitterTest, ScalarFormat) {
409409 " - simple scalar\n - 'explicit single-quoted scalar'\n - \" explicit "
410410 " double-quoted scalar\"\n - \" auto-detected\\ ndouble-quoted "
411411 " scalar\"\n - a "
412- " non-\" auto-detected\" double-quoted scalar\n - |\n literal scalar\n "
412+ " non-\" auto-detected\" double-quoted scalar\n - |- \n literal scalar\n "
413413 " "
414414 " that may span\n many, many\n lines and have \" whatever\" "
415415 " crazy\t symbols that we like" );
@@ -424,18 +424,34 @@ TEST_F(EmitterTest, LiteralWithoutTrailingSpaces) {
424424 out << YAML::EndMap;
425425
426426 ExpectEmit (
427- " key: |\n "
427+ " key: |- \n "
428428 " expect that with two newlines\n\n "
429429 " no spaces are emitted in the empty line" );
430430}
431431
432+ TEST_F (EmitterTest, LiteralWithAndWithoutTrailingEmptyLines) {
433+ out << BeginSeq;
434+ out << Literal << " A\n B" ;
435+ out << Literal << " A\n B\n " ;
436+ out << Literal << " A\n B\n\n\n " ;
437+ out << " something" ;
438+ out << EndSeq;
439+
440+ ExpectEmit (
441+ " - |-\n A\n B\n "
442+ " - |\n A\n B\n "
443+ " - |+\n A\n B\n\n\n "
444+ " - something" );
445+ }
446+
447+
432448TEST_F (EmitterTest, AutoLongKeyScalar) {
433449 out << BeginMap;
434450 out << Key << Literal << " multi-line\n scalar" ;
435451 out << Value << " and its value" ;
436452 out << EndMap;
437453
438- ExpectEmit (" ? |\n multi-line\n scalar\n : and its value" );
454+ ExpectEmit (" ? |- \n multi-line\n scalar\n : and its value" );
439455}
440456
441457TEST_F (EmitterTest, LongKeyFlowMap) {
@@ -717,7 +733,7 @@ TEST_F(EmitterTest, ComplexDoc) {
717733 " given: Dorothy\n family: Gale\n items:\n - part_no: A4786\n "
718734 " descrip: Water Bucket (Filled)\n price: 1.47\n quantity: 4\n - "
719735 " part_no: E1628\n descrip: High Heeled \" Ruby\" Slippers\n price: "
720- " 100.27\n quantity: 1\n bill-to: &id001\n street: |\n 123 Tornado "
736+ " 100.27\n quantity: 1\n bill-to: &id001\n street: |- \n 123 Tornado "
721737 " Alley\n Suite 16\n city: East Westville\n state: KS\n ship-to: "
722738 " *id001" );
723739}
0 commit comments