@@ -1065,6 +1065,48 @@ TEST_CASE("deserialization")
1065
1065
" start_array()"
1066
1066
}));
1067
1067
}
1068
+
1069
+ SECTION (" JSON Lines" )
1070
+ {
1071
+ SECTION (" Example file" )
1072
+ {
1073
+ std::stringstream ss;
1074
+ ss << R"( {"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
1075
+ {"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
1076
+ {"name": "May", "wins": []}
1077
+ {"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
1078
+ )" ;
1079
+
1080
+ std::string line;
1081
+ int object_count = 0 ;
1082
+ while (std::getline (ss, line))
1083
+ {
1084
+ ++object_count;
1085
+ CHECK (json::accept (line));
1086
+ }
1087
+
1088
+ CHECK (object_count == 4 );
1089
+ }
1090
+
1091
+ SECTION (" Example file without trailing newline" )
1092
+ {
1093
+ std::stringstream ss;
1094
+ ss << R"( {"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
1095
+ {"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
1096
+ {"name": "May", "wins": []}
1097
+ {"name": "Deloise", "wins": [["three of a kind", "5♣"]]})" ;
1098
+
1099
+ std::string line;
1100
+ int object_count = 0 ;
1101
+ while (std::getline (ss, line))
1102
+ {
1103
+ ++object_count;
1104
+ CHECK (json::accept (line));
1105
+ }
1106
+
1107
+ CHECK (object_count == 4 );
1108
+ }
1109
+ }
1068
1110
}
1069
1111
1070
1112
TEST_CASE_TEMPLATE (" deserialization of different character types (ASCII)" , T,
0 commit comments