Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to verify issue 1979 #1980

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"future": "cpp",
"queue": "cpp",
"shared_mutex": "cpp",
"ranges": "cpp"
"ranges": "cpp",
"span": "cpp"
}
}
25 changes: 17 additions & 8 deletions tests/dom/basictests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,22 @@ namespace dom_api_tests {
return true;
}

bool issue1979() {
TEST_START();
auto json = R"({
"@avito-core/toggles:6.1.18": {
"add_model_review_from": true
}
})"_padded;
simdjson::dom::parser parser;
simdjson::dom::element doc;
ASSERT_SUCCESS(parser.parse(json).get(doc));
simdjson::dom::object main_object;
ASSERT_SUCCESS(doc.get_object().get(main_object));
ASSERT_SUCCESS(main_object["@avito-core/toggles:6.1.18"].get_object().error())
TEST_SUCCEED();
}

bool document_object_index() {
std::cout << "Running " << __func__ << std::endl;
string json(R"({ "a": 1, "b": 2, "c/d": 3})");
Expand All @@ -978,14 +994,6 @@ namespace dom_api_tests {

simdjson::error_code error;
simdjson_unused element val;
// This is disabled, see https://github.com/simdjson/simdjson/issues/1243
//#ifndef _LIBCPP_VERSION // should work everywhere but with libc++, must include the <ciso646> header.
// std::tie(val,error) = object["d"];
// ASSERT_ERROR( error, NO_SUCH_FIELD );
// std::tie(std::ignore,error) = object["d"];
// ASSERT_ERROR( error, NO_SUCH_FIELD );
//#endif
// tie(val, error) = object["d"]; fails with "no viable overloaded '='" on Apple clang version 11.0.0 tie(val, error) = doc["d"];
object["d"].tie(val, error);
ASSERT_ERROR( error, NO_SUCH_FIELD );
ASSERT_ERROR( object["d"].get(val), NO_SUCH_FIELD );
Expand Down Expand Up @@ -1254,6 +1262,7 @@ namespace dom_api_tests {
#if SIMDJSON_ENABLE_DEPRECATED_API
ParsedJson_Iterator_test() &&
#endif
issue1979() &&
object_iterator() &&
array_iterator() &&
object_iterator_empty() &&
Expand Down
19 changes: 18 additions & 1 deletion tests/ondemand/ondemand_object_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ namespace object_tests {
using namespace std;
using simdjson::ondemand::json_type;

bool issue1979() {
TEST_START();
auto json = R"({
"@avito-core/toggles:6.1.18": {
"add_model_review_from": true
}
})"_padded;
ondemand::parser parser;
ondemand::document doc;
ASSERT_SUCCESS(parser.iterate(json).get(doc));
ondemand::object object;
ASSERT_SUCCESS(doc.get_object().get(object));
ASSERT_SUCCESS(object["@avito-core/toggles:6.1.18"].get_object().error());
TEST_SUCCEED();
}

bool issue1977() {
TEST_START();
auto json = R"({"1": 2} foo })"_padded;
Expand Down Expand Up @@ -1278,7 +1294,8 @@ namespace object_tests {
}

bool run() {
return issue1977() &&
return issue1979() &&
issue1977() &&
#if SIMDJSON_EXCEPTIONS
issue1965() &&
#endif
Expand Down