@@ -349,14 +349,14 @@ TEST_CASE("escape comment when writing", "IniFile")
349349
350350 REQUIRE (str == " [Fo\\ #o]\n "
351351 " he\\ #llo=world\n "
352- " world=he\\ #llo\n " );
352+ " world=he\\ #llo\n\n " );
353353}
354354
355355TEST_CASE (" decode what we encoded" , " IniFile" )
356356{
357357 std::string content = " [Fo\\ #o]\n "
358358 " he\\ REMllo=worl\\ REMd\n "
359- " world=he\\ //llo\n " ;
359+ " world=he\\ //llo\n\n " ;
360360
361361 ini::IniFile inif (' =' , {" #" , " REM" , " //" });
362362
@@ -397,7 +397,7 @@ TEST_CASE("save with bool fields", "IniFile")
397397 inif[" Foo" ][" bar2" ] = false ;
398398
399399 std::string result = inif.encode ();
400- REQUIRE (result == " [Foo]\n bar1=true\n bar2=false\n " );
400+ REQUIRE (result == " [Foo]\n bar1=true\n bar2=false\n\n " );
401401}
402402
403403TEST_CASE (" save with char fields" , " IniFile" )
@@ -407,7 +407,7 @@ TEST_CASE("save with char fields", "IniFile")
407407 inif[" Foo" ][" bar2" ] = static_cast <char >(' q' );
408408
409409 std::string result = inif.encode ();
410- REQUIRE (result == " [Foo]\n bar1=c\n bar2=q\n " );
410+ REQUIRE (result == " [Foo]\n bar1=c\n bar2=q\n\n " );
411411}
412412
413413TEST_CASE (" save with unsigned char fields" , " IniFile" )
@@ -417,7 +417,7 @@ TEST_CASE("save with unsigned char fields", "IniFile")
417417 inif[" Foo" ][" bar2" ] = static_cast <unsigned char >(' q' );
418418
419419 std::string result = inif.encode ();
420- REQUIRE (result == " [Foo]\n bar1=c\n bar2=q\n " );
420+ REQUIRE (result == " [Foo]\n bar1=c\n bar2=q\n\n " );
421421}
422422
423423TEST_CASE (" save with short fields" , " IniFile" )
@@ -427,7 +427,7 @@ TEST_CASE("save with short fields", "IniFile")
427427 inif[" Foo" ][" bar2" ] = static_cast <short >(-2 );
428428
429429 std::string result = inif.encode ();
430- REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n " );
430+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n\n " );
431431}
432432
433433TEST_CASE (" save with unsigned short fields" , " IniFile" )
@@ -437,7 +437,7 @@ TEST_CASE("save with unsigned short fields", "IniFile")
437437 inif[" Foo" ][" bar2" ] = static_cast <unsigned short >(13 );
438438
439439 std::string result = inif.encode ();
440- REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n " );
440+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n\n " );
441441}
442442
443443TEST_CASE (" save with int fields" , " IniFile" )
@@ -447,7 +447,7 @@ TEST_CASE("save with int fields", "IniFile")
447447 inif[" Foo" ][" bar2" ] = static_cast <int >(-2 );
448448
449449 std::string result = inif.encode ();
450- REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n " );
450+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n\n " );
451451}
452452
453453TEST_CASE (" save with unsigned int fields" , " IniFile" )
@@ -457,7 +457,7 @@ TEST_CASE("save with unsigned int fields", "IniFile")
457457 inif[" Foo" ][" bar2" ] = static_cast <unsigned int >(13 );
458458
459459 std::string result = inif.encode ();
460- REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n " );
460+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n\n " );
461461}
462462
463463TEST_CASE (" save with long fields" , " IniFile" )
@@ -467,7 +467,7 @@ TEST_CASE("save with long fields", "IniFile")
467467 inif[" Foo" ][" bar2" ] = static_cast <long >(-2 );
468468
469469 std::string result = inif.encode ();
470- REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n " );
470+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=-2\n\n " );
471471}
472472
473473TEST_CASE (" save with unsigned long fields" , " IniFile" )
@@ -477,7 +477,7 @@ TEST_CASE("save with unsigned long fields", "IniFile")
477477 inif[" Foo" ][" bar2" ] = static_cast <unsigned long >(13 );
478478
479479 std::string result = inif.encode ();
480- REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n " );
480+ REQUIRE (result == " [Foo]\n bar1=1\n bar2=13\n\n " );
481481}
482482
483483TEST_CASE (" save with double fields" , " IniFile" )
@@ -487,7 +487,7 @@ TEST_CASE("save with double fields", "IniFile")
487487 inif[" Foo" ][" bar2" ] = static_cast <double >(-2.4 );
488488
489489 std::string result = inif.encode ();
490- REQUIRE (result == " [Foo]\n bar1=1.2\n bar2=-2.4\n " );
490+ REQUIRE (result == " [Foo]\n bar1=1.2\n bar2=-2.4\n\n " );
491491}
492492
493493TEST_CASE (" save with float fields" , " IniFile" )
@@ -497,7 +497,7 @@ TEST_CASE("save with float fields", "IniFile")
497497 inif[" Foo" ][" bar2" ] = static_cast <float >(-2 .4f );
498498
499499 std::string result = inif.encode ();
500- REQUIRE (result == " [Foo]\n bar1=1.2\n bar2=-2.4\n " );
500+ REQUIRE (result == " [Foo]\n bar1=1.2\n bar2=-2.4\n\n " );
501501}
502502
503503TEST_CASE (" save with std::string fields" , " IniFile" )
@@ -507,7 +507,7 @@ TEST_CASE("save with std::string fields", "IniFile")
507507 inif[" Foo" ][" bar2" ] = static_cast <std::string>(" world" );
508508
509509 std::string result = inif.encode ();
510- REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n " );
510+ REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n\n " );
511511}
512512
513513TEST_CASE (" save with const char* fields" , " IniFile" )
@@ -517,7 +517,7 @@ TEST_CASE("save with const char* fields", "IniFile")
517517 inif[" Foo" ][" bar2" ] = static_cast <const char *>(" world" );
518518
519519 std::string result = inif.encode ();
520- REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n " );
520+ REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n\n " );
521521}
522522
523523TEST_CASE (" save with char* fields" , " IniFile" )
@@ -529,7 +529,7 @@ TEST_CASE("save with char* fields", "IniFile")
529529 inif[" Foo" ][" bar2" ] = static_cast <char *>(bar2);
530530
531531 std::string result = inif.encode ();
532- REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n " );
532+ REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n\n " );
533533}
534534
535535TEST_CASE (" save with string literal fields" , " IniFile" )
@@ -539,7 +539,7 @@ TEST_CASE("save with string literal fields", "IniFile")
539539 inif[" Foo" ][" bar2" ] = " world" ;
540540
541541 std::string result = inif.encode ();
542- REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n " );
542+ REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n\n " );
543543}
544544
545545#ifdef __cpp_lib_string_view
@@ -550,7 +550,7 @@ TEST_CASE("save with std::string_view fields", "IniFile")
550550 inif[" Foo" ][" bar2" ] = std::string_view (" world" );
551551
552552 std::string result = inif.encode ();
553- REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n " );
553+ REQUIRE (result == " [Foo]\n bar1=hello\n bar2=world\n\n " );
554554}
555555#endif
556556
@@ -561,7 +561,7 @@ TEST_CASE("save with custom field sep", "IniFile")
561561 inif[" Foo" ][" bar2" ] = false ;
562562
563563 std::string result = inif.encode ();
564- REQUIRE (result == " [Foo]\n bar1:true\n bar2:false\n " );
564+ REQUIRE (result == " [Foo]\n bar1:true\n bar2:false\n\n " );
565565}
566566
567567TEST_CASE (" inline comments in sections are discarded" , " IniFile" )
@@ -686,7 +686,7 @@ TEST_CASE("when multi-line values are enabled, write newlines as multi-line valu
686686
687687 REQUIRE (str == " [Foo]\n "
688688 " bar=Hello\n "
689- " \t world!\n " );
689+ " \t world!\n\n " );
690690}
691691
692692TEST_CASE (" stringInsensitiveLess operator() returns true if and only if first parameter is less than the second "
@@ -902,4 +902,4 @@ TEST_CASE("parse section with duplicate field and overwriteDuplicateFields_ set
902902 ini::IniFile inif;
903903 inif.allowOverwriteDuplicateFields (false );
904904 REQUIRE_THROWS (inif.decode (" [Foo]\n bar=hello\n bar=world" ));
905- }
905+ }
0 commit comments