Small test for document_reference usage. (#1694)

This commit is contained in:
Daniel Lemire 2021-08-10 21:08:59 -04:00 committed by GitHub
parent a552638373
commit ba46616cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -20,6 +20,21 @@ namespace misc_tests {
TEST_SUCCEED(); TEST_SUCCEED();
} }
bool doc_ref() {
TEST_START();
ondemand::parser parser;
padded_string docdata = R"({"":2,"v":[]})"_padded;
ondemand::document doc;
ASSERT_SUCCESS(parser.iterate(docdata).get(doc));
ondemand::document_reference ref(doc);
ondemand::value arr;
ASSERT_SUCCESS(ref["v"].get(arr));
ondemand::json_type global_type;
ASSERT_SUCCESS(arr.type().get(global_type));
ASSERT_EQUAL(global_type, ondemand::json_type::array);
TEST_SUCCEED();
}
bool issue1660() { bool issue1660() {
TEST_START(); TEST_START();
ondemand::parser parser; ondemand::parser parser;
@ -345,6 +360,7 @@ namespace misc_tests {
big_integer_in_string() && big_integer_in_string() &&
big_integer() && big_integer() &&
raw_json_token() && raw_json_token() &&
doc_ref() &&
true; true;
} }