1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

Everywhere: Rename {Deprecated => Byte}String

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')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -6,7 +6,7 @@
#include <LibTest/TestCase.h>
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
TEST_CASE(construct_empty)
@ -29,8 +29,8 @@ TEST_CASE(view_literal)
TEST_CASE(compare_views)
{
DeprecatedString foo1 = "foo";
DeprecatedString foo2 = "foo";
ByteString foo1 = "foo";
ByteString foo2 = "foo";
auto view1 = foo1.view();
auto view2 = foo2.view();
@ -43,7 +43,7 @@ TEST_CASE(compare_views)
TEST_CASE(string_view_literal_operator)
{
StringView literal_view = "foo"sv;
DeprecatedString test_string = "foo";
ByteString test_string = "foo";
EXPECT_EQ(literal_view.length(), test_string.length());
EXPECT_EQ(literal_view, test_string);
@ -51,7 +51,7 @@ TEST_CASE(string_view_literal_operator)
TEST_CASE(starts_with)
{
DeprecatedString test_string = "ABCDEF";
ByteString test_string = "ABCDEF";
StringView test_string_view = test_string.view();
EXPECT(test_string_view.starts_with('A'));
EXPECT(!test_string_view.starts_with('B'));
@ -64,7 +64,7 @@ TEST_CASE(starts_with)
TEST_CASE(ends_with)
{
DeprecatedString test_string = "ABCDEF";
ByteString test_string = "ABCDEF";
StringView test_string_view = test_string.view();
EXPECT(test_string_view.ends_with("DEF"sv));
EXPECT(test_string_view.ends_with('F'));
@ -78,23 +78,23 @@ TEST_CASE(ends_with)
TEST_CASE(lines)
{
DeprecatedString test_string = "a\rb\nc\r\nd";
ByteString test_string = "a\rb\nc\r\nd";
StringView test_string_view = test_string.view();
Vector<StringView> test_string_vector = test_string_view.lines();
EXPECT_EQ(test_string_vector.size(), 4u);
EXPECT(test_string_vector.at(0) == DeprecatedString("a"));
EXPECT(test_string_vector.at(1) == DeprecatedString("b"));
EXPECT(test_string_vector.at(2) == DeprecatedString("c"));
EXPECT(test_string_vector.at(3) == DeprecatedString("d"));
EXPECT(test_string_vector.at(0) == ByteString("a"));
EXPECT(test_string_vector.at(1) == ByteString("b"));
EXPECT(test_string_vector.at(2) == ByteString("c"));
EXPECT(test_string_vector.at(3) == ByteString("d"));
test_string = "```\nHello there\r\nHello there\n```";
test_string_view = test_string.view();
test_string_vector = test_string_view.lines();
EXPECT_EQ(test_string_vector.size(), 4u);
EXPECT(test_string_vector.at(0) == DeprecatedString("```"));
EXPECT(test_string_vector.at(1) == DeprecatedString("Hello there"));
EXPECT(test_string_vector.at(2) == DeprecatedString("Hello there"));
EXPECT(test_string_vector.at(3) == DeprecatedString("```"));
EXPECT(test_string_vector.at(0) == ByteString("```"));
EXPECT(test_string_vector.at(1) == ByteString("Hello there"));
EXPECT(test_string_vector.at(2) == ByteString("Hello there"));
EXPECT(test_string_vector.at(3) == ByteString("```"));
test_string = "\n\n\n";
test_string_view = test_string.view();