Skip to content

Commit b1faba9

Browse files
hugo-dcchfast
authored andcommitted
statetest: Make JSON _info section optional
1 parent c931df7 commit b1faba9

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

test/statetest/statetest_loader.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,13 @@ static void from_json(const json::json& j, StateTransitionTest& o)
397397

398398
o.block = from_json<state::BlockInfo>(j_t.at("env"));
399399

400-
if (const auto& info = j_t.at("_info"); info.contains("labels"))
400+
if (const auto info_it = j_t.find("_info"); info_it != j_t.end())
401401
{
402-
for (const auto& [j_id, j_label] : info.at("labels").items())
403-
o.input_labels.emplace(from_json<uint64_t>(j_id), j_label);
402+
if (const auto labels_it = info_it->find("labels"); labels_it != info_it->end())
403+
{
404+
for (const auto& [j_id, j_label] : labels_it->items())
405+
o.input_labels.emplace(from_json<uint64_t>(j_id), j_label);
406+
}
404407
}
405408

406409
for (const auto& [rev_name, expectations] : j_t.at("post").items())

test/unittests/statetest_loader_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ TEST(statetest_loader, load_minimal_test)
7474
{
7575
std::istringstream s{R"({
7676
"test": {
77-
"_info": {},
7877
"pre": {},
7978
"transaction": {
8079
"gasPrice": "",

0 commit comments

Comments
 (0)