This adds a test to explain better the issue 1341: Support conversion of simdjson_result lvalue to dom::element (#1397)

* This adds a test to explain better the issue.

* Guarding it since it can throw.
This commit is contained in:
Daniel Lemire
2021-01-16 15:08:27 -05:00
committed by GitHub
parent 6e5d232ccc
commit 73063e2dab
+6
View File
@@ -795,6 +795,12 @@ namespace dom_api_tests {
dom::parser parser;
dom::object object;
ASSERT_SUCCESS( parser.parse(json).get(object) );
#if SIMDJSON_EXCEPTIONS
// Next three lines are for https://github.com/simdjson/simdjson/issues/1341
dom::element node = object["a"]; // might throw
auto mylambda = [](dom::element e) { return int64_t(e); };
ASSERT_EQUAL( mylambda(node), 1 );
#endif
ASSERT_EQUAL( object["a"].get<uint64_t>().first, 1 );
ASSERT_EQUAL( object["b"].get<uint64_t>().first, 2 );
ASSERT_EQUAL( object["c/d"].get<uint64_t>().first, 3 );