mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -4,13 +4,13 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonParser.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
bool write_lines(Span<String> lines)
|
||||
bool write_lines(Span<DeprecatedString> lines)
|
||||
{
|
||||
// It's possible the process dies before we can write all the tests
|
||||
// to the stdin. So make sure that we don't crash but just stop writing.
|
||||
|
@ -160,8 +160,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
for (String const& line : lines) {
|
||||
if (!m_output->write_or_error(String::formatted("{}\n", line).bytes()))
|
||||
for (DeprecatedString const& line : lines) {
|
||||
if (!m_output->write_or_error(DeprecatedString::formatted("{}\n", line).bytes()))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -175,14 +175,14 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
String read_all()
|
||||
DeprecatedString read_all()
|
||||
{
|
||||
auto all_output_or_error = m_input->read_all();
|
||||
if (all_output_or_error.is_error()) {
|
||||
warnln("Got error: {} while reading runner output", all_output_or_error.error());
|
||||
return ""sv;
|
||||
}
|
||||
return String(all_output_or_error.value().bytes(), Chomp);
|
||||
return DeprecatedString(all_output_or_error.value().bytes(), Chomp);
|
||||
}
|
||||
|
||||
enum class ProcessResult {
|
||||
|
@ -222,7 +222,7 @@ public:
|
|||
NonnullOwnPtr<Core::Stream::File> m_output;
|
||||
};
|
||||
|
||||
static HashMap<size_t, TestResult> run_test_files(Span<String> files, size_t offset, StringView command, char const* const arguments[])
|
||||
static HashMap<size_t, TestResult> run_test_files(Span<DeprecatedString> files, size_t offset, StringView command, char const* const arguments[])
|
||||
{
|
||||
HashMap<size_t, TestResult> results {};
|
||||
results.ensure_capacity(files.size());
|
||||
|
@ -246,7 +246,7 @@ static HashMap<size_t, TestResult> run_test_files(Span<String> files, size_t off
|
|||
return results;
|
||||
}
|
||||
|
||||
String output = runner_process->read_all();
|
||||
DeprecatedString output = runner_process->read_all();
|
||||
auto status_or_error = runner_process->status();
|
||||
bool failed = false;
|
||||
if (!status_or_error.is_error()) {
|
||||
|
@ -297,7 +297,7 @@ static HashMap<size_t, TestResult> run_test_files(Span<String> files, size_t off
|
|||
return results;
|
||||
}
|
||||
|
||||
void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<String> const& paths, StringView per_file_name, double time_taken_in_ms);
|
||||
void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<DeprecatedString> const& paths, StringView per_file_name, double time_taken_in_ms);
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
@ -320,12 +320,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
// Normalize the path to ensure filenames are consistent
|
||||
Vector<String> paths;
|
||||
Vector<DeprecatedString> paths;
|
||||
|
||||
if (!Core::File::is_directory(test_directory)) {
|
||||
paths.append(test_directory);
|
||||
} else {
|
||||
Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](String const& file_path) {
|
||||
Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) {
|
||||
if (file_path.contains("_FIXTURE"sv))
|
||||
return;
|
||||
// FIXME: Add ignored file set
|
||||
|
@ -337,7 +337,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln("Found {} tests", paths.size());
|
||||
|
||||
auto parameters = pass_through_parameters.split_view(' ');
|
||||
Vector<String> args;
|
||||
Vector<DeprecatedString> args;
|
||||
args.ensure_capacity(parameters.size() + 2);
|
||||
args.append(runner_command);
|
||||
if (!dont_disable_core_dump)
|
||||
|
@ -408,7 +408,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<String> const& paths, StringView per_file_name, double time_taken_in_ms)
|
||||
void write_per_file(HashMap<size_t, TestResult> const& result_map, Vector<DeprecatedString> const& paths, StringView per_file_name, double time_taken_in_ms)
|
||||
{
|
||||
|
||||
auto file_or_error = Core::Stream::File::open(per_file_name, Core::Stream::OpenMode::Write);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue