mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 04:50:08 +03:00
5e1499d104
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2022, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/Map.h>
|
|
#include <LibTest/JavaScriptTestRunner.h>
|
|
|
|
TEST_ROOT("Userland/Applications/Spreadsheet/Tests");
|
|
|
|
#ifdef AK_OS_SERENITY
|
|
static constexpr auto s_spreadsheet_runtime_path = "/res/js/Spreadsheet/runtime.js"sv;
|
|
#else
|
|
static constexpr auto s_spreadsheet_runtime_path = "../../../../Base/res/js/Spreadsheet/runtime.js"sv;
|
|
#endif
|
|
|
|
TESTJS_RUN_FILE_FUNCTION(ByteString const&, JS::Realm& realm, JS::ExecutionContext& global_execution_context)
|
|
{
|
|
auto run_file = [&](StringView name) {
|
|
auto result = Test::JS::parse_script(name, realm);
|
|
if (result.is_error()) {
|
|
warnln("Unable to parse {}", name);
|
|
warnln("{}", result.error().error.to_byte_string());
|
|
warnln("{}", result.error().hint);
|
|
Test::cleanup_and_exit();
|
|
}
|
|
auto script = result.release_value();
|
|
|
|
realm.vm().push_execution_context(global_execution_context);
|
|
MUST(realm.vm().bytecode_interpreter().run(*script));
|
|
realm.vm().pop_execution_context();
|
|
};
|
|
|
|
#ifdef AK_OS_SERENITY
|
|
run_file(s_spreadsheet_runtime_path);
|
|
#else
|
|
run_file(LexicalPath::join(Test::JS::g_test_root, s_spreadsheet_runtime_path).string());
|
|
#endif
|
|
|
|
run_file("mock.test-common.js"sv);
|
|
|
|
return Test::JS::RunFileHookResult::RunAsNormal;
|
|
}
|