LibTest: Replace uses of JsonObject::get_deprecated()/get_ptr()

This commit is contained in:
Sam Atkins 2022-12-21 17:28:11 +00:00 committed by Tim Flynn
parent 783251b98a
commit 4dac287aa5

View file

@ -422,9 +422,9 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
VERIFY(test_value.is_object());
VERIFY(test_value.as_object().has("result"sv));
auto result = test_value.as_object().get_deprecated("result"sv);
VERIFY(result.is_string());
auto result_string = result.as_string();
auto result = test_value.as_object().get_deprecated_string("result"sv);
VERIFY(result.has_value());
auto result_string = result.value();
if (result_string == "pass") {
test.result = Test::Result::Pass;
m_counts.tests_passed++;
@ -433,9 +433,9 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
m_counts.tests_failed++;
suite.most_severe_test_result = Test::Result::Fail;
VERIFY(test_value.as_object().has("details"sv));
auto details = test_value.as_object().get_deprecated("details"sv);
VERIFY(result.is_string());
test.details = details.as_string();
auto details = test_value.as_object().get_deprecated_string("details"sv);
VERIFY(result.has_value());
test.details = details.value();
} else {
test.result = Test::Result::Skip;
if (suite.most_severe_test_result == Test::Result::Pass)
@ -443,7 +443,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path)
m_counts.tests_skipped++;
}
test.duration_us = test_value.as_object().get_deprecated("duration"sv).to_u64(0);
test.duration_us = test_value.as_object().get_u64("duration"sv).value_or(0);
suite.tests.append(test);
});