🔨 fixing last failing test cases
This commit is contained in:
parent
b0c47abd88
commit
bbb6bd9de5
3 changed files with 37 additions and 45 deletions
27
src/json.hpp
27
src/json.hpp
|
@ -7179,7 +7179,7 @@ class basic_json
|
|||
static basic_json parse(const CharT s,
|
||||
const parser_callback_t cb = nullptr)
|
||||
{
|
||||
return parser(reinterpret_cast<const char*>(s), cb).parse();
|
||||
return parser(reinterpret_cast<const char*>(s), cb).parse(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -7214,7 +7214,7 @@ class basic_json
|
|||
static basic_json parse(std::istream& i,
|
||||
const parser_callback_t cb = nullptr)
|
||||
{
|
||||
return parser(i, cb).parse();
|
||||
return parser(i, cb).parse(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -7223,7 +7223,7 @@ class basic_json
|
|||
static basic_json parse(std::istream&& i,
|
||||
const parser_callback_t cb = nullptr)
|
||||
{
|
||||
return parser(i, cb).parse();
|
||||
return parser(i, cb).parse(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -7295,10 +7295,10 @@ class basic_json
|
|||
// to generate "unexpected EOF" error message
|
||||
if (std::distance(first, last) <= 0)
|
||||
{
|
||||
return parser("").parse();
|
||||
return parser("").parse(true);
|
||||
}
|
||||
|
||||
return parser(first, last, cb).parse();
|
||||
return parser(first, last, cb).parse(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -7386,7 +7386,7 @@ class basic_json
|
|||
*/
|
||||
friend std::istream& operator<<(basic_json& j, std::istream& i)
|
||||
{
|
||||
j = parser(i).parse();
|
||||
j = parser(i).parse(false);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -7396,7 +7396,7 @@ class basic_json
|
|||
*/
|
||||
friend std::istream& operator>>(std::istream& i, basic_json& j)
|
||||
{
|
||||
j = parser(i).parse();
|
||||
j = parser(i).parse(false);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -11043,7 +11043,7 @@ class basic_json
|
|||
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
||||
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 9, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,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9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
|
||||
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
||||
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
||||
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 8, 10, 8, 10, 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
||||
{9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 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, 9, 9, 9, 9, 9, 9, 9, 9, 9},
|
||||
|
@ -11423,11 +11423,14 @@ class basic_json
|
|||
|
||||
/*!
|
||||
@brief public parser interface
|
||||
|
||||
@param[in] strict whether to expect the last token to be EOF
|
||||
|
||||
@throw parse_error.101 in case of an unexpected token
|
||||
@throw parse_error.102 if to_unicode fails or surrogate error
|
||||
@throw parse_error.103 if to_unicode fails
|
||||
*/
|
||||
basic_json parse()
|
||||
basic_json parse(const bool strict = true)
|
||||
{
|
||||
// read first token
|
||||
get_token();
|
||||
|
@ -11435,8 +11438,10 @@ class basic_json
|
|||
basic_json result = parse_internal(true);
|
||||
result.assert_invariant();
|
||||
|
||||
// FIXME: this is new behavior
|
||||
//expect(lexer::token_type::end_of_input);
|
||||
if (strict)
|
||||
{
|
||||
expect(lexer::token_type::end_of_input);
|
||||
}
|
||||
|
||||
// return parser result and replace it with null in case the
|
||||
// top-level value was discarded by the callback function
|
||||
|
|
|
@ -306,9 +306,9 @@ TEST_CASE("parser class")
|
|||
CHECK_THROWS_AS(json::parser("+0").parse(), json::parse_error);
|
||||
|
||||
CHECK_THROWS_WITH(json::parser("01").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 2: syntax error - unexpected '01'");
|
||||
"[json.exception.parse_error.101] parse error at 2: syntax error - unexpected number literal; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-01").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected '-01'");
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected number literal; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("--1").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 2: syntax error - invalid number; expected digit after '-'; last read '--'");
|
||||
CHECK_THROWS_WITH(json::parser("1.").parse(),
|
||||
|
@ -318,7 +318,7 @@ TEST_CASE("parser class")
|
|||
CHECK_THROWS_WITH(json::parser("1E-").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid number; expected digit after exponent sign; last read '1E-'");
|
||||
CHECK_THROWS_WITH(json::parser("1.E1").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 2: syntax error - unexpected '.'; expected end of input");
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - invalid number; expected digit after '.'; last read '1.E'");
|
||||
CHECK_THROWS_WITH(json::parser("-1E").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid number; expected '+', '-', or digit after exponent; last read '-1E'");
|
||||
CHECK_THROWS_WITH(json::parser("-0E#").parse(),
|
||||
|
@ -326,19 +326,19 @@ TEST_CASE("parser class")
|
|||
CHECK_THROWS_WITH(json::parser("-0E-#").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - invalid number; expected digit after exponent sign; last read '-0E-#'");
|
||||
CHECK_THROWS_WITH(json::parser("-0#").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected '#'; expected end of input");
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - invalid literal; last read: '-0#'; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-0.0:").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - unexpected ':'; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-0.0Z").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - unexpected 'Z'; expected end of input");
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - invalid literal; last read: '-0.0Z'; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-0E123:").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 7: syntax error - unexpected ':'; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-0e0-:").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - unexpected '-'; expected end of input");
|
||||
"[json.exception.parse_error.101] parse error at 6: syntax error - invalid number; expected digit after '-'; last read: '-:'; expected end of input");
|
||||
CHECK_THROWS_WITH(json::parser("-0e-:").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 5: syntax error - invalid number; expected digit after exponent sign; last read '-0e-:'");
|
||||
CHECK_THROWS_WITH(json::parser("-0f").parse(),
|
||||
"[json.exception.parse_error.101] parse error at 3: syntax error - unexpected 'f'; expected end of input");
|
||||
"[json.exception.parse_error.101] parse error at 4: syntax error - invalid literal; expected 'false'; last read: '-0f'; expected end of input");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,8 @@ TEST_CASE("compliance tests from json.org")
|
|||
})
|
||||
{
|
||||
CAPTURE(filename);
|
||||
json j;
|
||||
std::ifstream f(filename);
|
||||
CHECK_THROWS_AS(j << f, json::parse_error);
|
||||
CHECK_THROWS_AS(json::parse(f), json::parse_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,9 +92,8 @@ TEST_CASE("compliance tests from json.org")
|
|||
})
|
||||
{
|
||||
CAPTURE(filename);
|
||||
json j;
|
||||
std::ifstream f(filename);
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +318,7 @@ TEST_CASE("test suite from json-test-suite")
|
|||
// strings in a JSON array
|
||||
std::ifstream f("test/data/json_testsuite/sample.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(j = json::parse(f));
|
||||
|
||||
// the array has 3 elements
|
||||
CHECK(j.size() == 3);
|
||||
|
@ -334,36 +332,31 @@ TEST_CASE("json.org examples")
|
|||
SECTION("1.json")
|
||||
{
|
||||
std::ifstream f("test/data/json.org/1.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
|
||||
SECTION("2.json")
|
||||
{
|
||||
std::ifstream f("test/data/json.org/2.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
|
||||
SECTION("3.json")
|
||||
{
|
||||
std::ifstream f("test/data/json.org/3.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
|
||||
SECTION("4.json")
|
||||
{
|
||||
std::ifstream f("test/data/json.org/4.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
|
||||
SECTION("5.json")
|
||||
{
|
||||
std::ifstream f("test/data/json.org/5.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,8 +538,7 @@ TEST_CASE("nst's JSONTestSuite")
|
|||
{
|
||||
CAPTURE(filename);
|
||||
std::ifstream f(filename);
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,8 +746,7 @@ TEST_CASE("nst's JSONTestSuite")
|
|||
{
|
||||
CAPTURE(filename);
|
||||
std::ifstream f(filename);
|
||||
json j;
|
||||
CHECK_THROWS_AS(j << f, json::parse_error);
|
||||
CHECK_THROWS_AS(json::parse(f), json::parse_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -777,8 +768,7 @@ TEST_CASE("nst's JSONTestSuite")
|
|||
{
|
||||
CAPTURE(filename);
|
||||
std::ifstream f(filename);
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -797,8 +787,7 @@ TEST_CASE("nst's JSONTestSuite")
|
|||
{
|
||||
CAPTURE(filename);
|
||||
std::ifstream f(filename);
|
||||
json j;
|
||||
CHECK_THROWS_AS(j << f, json::out_of_range);
|
||||
CHECK_THROWS_AS(json::parse(f), json::out_of_range);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -824,8 +813,7 @@ TEST_CASE("nst's JSONTestSuite")
|
|||
{
|
||||
CAPTURE(filename);
|
||||
std::ifstream f(filename);
|
||||
json j;
|
||||
CHECK_THROWS_AS(j << f, json::parse_error);
|
||||
CHECK_THROWS_AS(json::parse(f), json::parse_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -851,8 +839,7 @@ TEST_CASE("Big List of Naughty Strings")
|
|||
SECTION("parsing blns.json")
|
||||
{
|
||||
std::ifstream f("test/data/big-list-of-naughty-strings/blns.json");
|
||||
json j;
|
||||
CHECK_NOTHROW(j << f);
|
||||
CHECK_NOTHROW(json::parse(f));
|
||||
}
|
||||
|
||||
// check if parsed strings roundtrip
|
||||
|
|
Loading…
Reference in a new issue