mirror of
https://github.com/nlohmann/json
synced 2024-11-23 20:40:08 +00:00
Test to confirm parsing of multiple JSON records in a istream #367
This commit is contained in:
parent
90adf6ec20
commit
f585fe4eec
@ -1233,4 +1233,24 @@ TEST_CASE("regression tests")
|
||||
"[json.exception.type_error.302] type must be array, but is null");
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("issue #367 - Behavior of operator>> should more closely resemble that of built-in overloads.")
|
||||
{
|
||||
SECTION("example 1")
|
||||
{
|
||||
std::istringstream i1_2_3( "{\"first\": \"one\" }{\"second\": \"two\"}3" );
|
||||
json j1, j2, j3;
|
||||
i1_2_3 >> j1;
|
||||
i1_2_3 >> j2;
|
||||
i1_2_3 >> j3;
|
||||
|
||||
std::map<std::string,std::string> m1 = j1;
|
||||
std::map<std::string,std::string> m2 = j2;
|
||||
int i3 = j3;
|
||||
|
||||
CHECK( m1 == ( std::map<std::string,std::string> {{ "first", "one" }} ));
|
||||
CHECK( m2 == ( std::map<std::string,std::string> {{ "second", "two" }} ));
|
||||
CHECK( i3 == 3 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user