Skip to content

Commit

Permalink
Improve skip_space
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 15, 2024
1 parent 9fb6fac commit efb3b00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions include/jsoncons/json_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,7 @@ class basic_json_parser : public ser_context, public virtual basic_parser_input<
{
for (; input_ptr_ != input_end_; ++input_ptr_)
{
char_type curr_char_ = *input_ptr_;
switch (curr_char_)
switch (*input_ptr_)
{
case '\n':
case '\r':
Expand Down
12 changes: 7 additions & 5 deletions test/corelib/src/json_reader_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,18 @@ TEST_CASE("json_reader json lines")
json_decoder<json> decoder;
json_stream_reader reader(is, decoder);

CHECK(!reader.eof());
REQUIRE(!reader.eof());
reader.read_next();
CHECK(!reader.eof());
CHECK(decoder.get_result() == json::parse(R"(["Name", "Session", "Score", "Completed"])"));
REQUIRE(!reader.eof());
reader.read_next();
CHECK(!reader.eof());
REQUIRE(!reader.eof());
reader.read_next();
CHECK(!reader.eof());
REQUIRE(!reader.eof());
reader.read_next();
CHECK(!reader.eof());
REQUIRE(!reader.eof());
reader.read_next();
CHECK(decoder.get_result() == json::parse(R"(["Deloise", "2012A", 19, true])"));
CHECK(!reader.eof());
reader.read_next();
CHECK(reader.eof());
Expand Down

0 comments on commit efb3b00

Please sign in to comment.