Merge remote-tracking branch 'doppioandante/fix-json'
This commit is contained in:
commit
c032306e04
|
@ -261,7 +261,7 @@ parse_json(const char* pos, const char* end)
|
|||
{
|
||||
auto digit_end = pos;
|
||||
skip_while(digit_end, end, is_digit);
|
||||
return Result{ Value{str_to_int({pos, end})}, digit_end };
|
||||
return Result{ Value{str_to_int({pos, digit_end})}, digit_end };
|
||||
}
|
||||
if (end - pos > 4 and StringView{pos, pos+4} == "true")
|
||||
return Result{ Value{true}, pos+4 };
|
||||
|
@ -461,6 +461,12 @@ UnitTest test_json_parser{[]()
|
|||
kak_assert(value);
|
||||
}
|
||||
|
||||
{
|
||||
auto value = std::get<0>(parse_json("[10,20]"));
|
||||
kak_assert(value and value.is_a<JsonArray>());
|
||||
kak_assert(value.as<JsonArray>().at(1).as<int>() == 20);
|
||||
}
|
||||
|
||||
{
|
||||
auto value = std::get<0>(parse_json("{}"));
|
||||
kak_assert(value and value.is_a<JsonObject>());
|
||||
|
|
Loading…
Reference in New Issue
Block a user