@@ -203,36 +203,52 @@ struct Test_runner {
203203 check_eq (value.get_obj (), obj);
204204 }
205205
206- Object_type obj;
207- Value_type value;
206+ {
207+ Object_type obj;
208+ Value_type value;
208209
209- read_cstr (
210- " {\n "
211- " \" name 1\" : \" value 1\"\n "
212- " }" ,
213- value);
210+ read_cstr (
211+ " {\n "
212+ " \" name 1\" : \" value 1\"\n "
213+ " }" ,
214+ value);
214215
215- add_c_str (obj, " name 1" , " value 1" );
216+ add_c_str (obj, " name 1" , " value 1" );
216217
217- check_eq (value.get_obj (), obj);
218+ check_eq (value.get_obj (), obj);
218219
219- read_cstr (" {\" name 1\" :\" value 1\" ,\" name 2\" :\" value 2\" }" , value);
220+ read_cstr (" {\" name 1\" :\" value 1\" ,\" name 2\" :\" value 2\" }" , value);
220221
221- add_c_str (obj, " name 2" , " value 2" );
222+ add_c_str (obj, " name 2" , " value 2" );
222223
223- check_eq (value.get_obj (), obj);
224+ check_eq (value.get_obj (), obj);
224225
225- read_cstr (
226- " {\n "
227- " \" name 1\" : \" value 1\" ,\n "
228- " \" name 2\" : \" value 2\" ,\n "
229- " \" name 3\" : \" value 3\"\n "
230- " }" ,
231- value);
226+ read_cstr (
227+ " {\n "
228+ " \" name 1\" : \" value 1\" ,\n "
229+ " \" name 2\" : \" value 2\" ,\n "
230+ " \" name 3\" : \" value 3\"\n "
231+ " }" ,
232+ value);
233+
234+ add_c_str (obj, " name 3" , " value 3" );
235+
236+ check_eq (value.get_obj (), obj);
237+ }
238+
239+ {
240+ Object_type obj;
241+ Value_type value;
232242
233- add_c_str (obj, " name 3" , " value 3" );
243+ read_cstr (
244+ " {\n "
245+ " name 1 : \" value 1\"\n "
246+ " }" ,
247+ value);
234248
235- check_eq (value.get_obj (), obj);
249+ add_c_str (obj, " name 1" , " value 1" );
250+ check_eq (value.get_obj (), obj);
251+ }
236252
237253 check_reading (
238254 " {\n "
@@ -715,8 +731,11 @@ struct Test_runner {
715731 Istringstream_type is (str);
716732
717733 check_reading_array (is, 0 );
734+ is.unget ();
718735 check_reading_array (is, 1 );
736+ is.unget ();
719737 check_reading_array (is, 2 );
738+ is.unget ();
720739 check_reading_array (is, 3 );
721740 }
722741
@@ -729,12 +748,9 @@ struct Test_runner {
729748 check_value_sequence (" 10 11 12" , list_of (10 )(11 )(12 ), true );
730749 check_value_sequence (" 10 11 12" , list_of (10 )(11 )(12 ), true );
731750
732- //
733-
751+ // Note: check_reading_arrays() expects exactly this list of arrays.
734752 check_reading_arrays (" [] [ 1 ] [ 1, 2 ] [ 1, 2, 3 ]" );
735- // check_reading_arrays( "[][1][1,2][1,2,3]" ); // fails due to
736- // multi_pass iterator bug,
737- // use stream_reader class instead
753+ check_reading_arrays (" [][1][1,2][1,2,3]" );
738754 }
739755
740756 void test_uint64 (const char * value_str, int expected_int, int64_t expected_int64,
@@ -801,16 +817,27 @@ struct Test_runner {
801817 }
802818
803819 void run_tests () {
820+ std::cout << " before test_syntax()" << std::endl;
804821 test_syntax ();
822+ std::cout << " before test_reading()" << std::endl;
805823 test_reading ();
824+ std::cout << " before test_reading_reals()" << std::endl;
806825 test_reading_reals ();
826+ std::cout << " before test_from_stream()" << std::endl;
807827 test_from_stream ();
828+ std::cout << " before test_escape_chars()" << std::endl;
808829 test_escape_chars ();
830+ std::cout << " before test_values()" << std::endl;
809831 test_values ();
832+ std::cout << " before test_error_cases()" << std::endl;
810833 test_error_cases ();
834+ std::cout << " before test_sequence_of_values()" << std::endl;
811835 test_sequence_of_values ();
836+ std::cout << " before test_uint64()" << std::endl;
812837 test_uint64 ();
838+ std::cout << " before test_types()" << std::endl;
813839 test_types ();
840+ std::cout << " before test_comments()" << std::endl;
814841 test_comments ();
815842 }
816843};
@@ -848,17 +875,25 @@ void test_extended_ascii() {
848875
849876void json5_parser::test_reader () {
850877#ifdef JSON_SPIRIT_VALUE_ENABLED
878+ std::cout << " JSON_SPIRIT_VALUE_ENABLED" << std::endl;
851879 Test_runner<Config>().run_tests ();
852880 test_extended_ascii ();
853881#endif
854882#ifdef JSON_SPIRIT_MVALUE_ENABLED
883+ std::cout << " JSON_SPIRIT_MVALUE_ENABLED" << std::endl;
855884 Test_runner<mConfig >().run_tests ();
856885#endif
857886#if defined(JSON_SPIRIT_WVALUE_ENABLED) && !defined(BOOST_NO_STD_WSTRING)
887+ std::cout << " defined(JSON_SPIRIT_WVALUE_ENABLED) && "
888+ " !defined(BOOST_NO_STD_WSTRING)"
889+ << std::endl;
858890 Test_runner<wConfig>().run_tests ();
859891 test_wide_esc_u ();
860892#endif
861893#if defined(JSON_SPIRIT_WMVALUE_ENABLED) && !defined(BOOST_NO_STD_WSTRING)
894+ std::cout << " defined(JSON_SPIRIT_WMVALUE_ENABLED) && "
895+ " !defined(BOOST_NO_STD_WSTRING)"
896+ << std::endl;
862897 Test_runner<wmConfig>().run_tests ();
863898#endif
864899
@@ -880,7 +915,7 @@ void json5_parser::test_reader() {
880915
881916 // cout << t.elapsed() << endl;
882917
883- // const string so = write( value );
918+ // const string so = write( value );
884919
885920 // Object obj;
886921
0 commit comments