1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +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

@ -10,41 +10,41 @@
TEST_CASE(basic)
{
Tuple<int, DeprecatedString> value { 1, "foo" };
Tuple<int, ByteString> value { 1, "foo" };
EXPECT_EQ(value.get<int>(), 1);
EXPECT_EQ(value.get<DeprecatedString>(), "foo");
EXPECT_EQ(value.get<ByteString>(), "foo");
EXPECT_EQ(value.get<0>(), 1);
EXPECT_EQ(value.get<1>(), "foo");
// Move assignment
value = { 2, "bar" };
EXPECT_EQ(value.get<int>(), 2);
EXPECT_EQ(value.get<DeprecatedString>(), "bar");
EXPECT_EQ(value.get<ByteString>(), "bar");
EXPECT_EQ(value.get<0>(), 2);
EXPECT_EQ(value.get<1>(), "bar");
// Copy ctor
auto other_value { value };
EXPECT_EQ(other_value.get<int>(), 2);
EXPECT_EQ(other_value.get<DeprecatedString>(), "bar");
EXPECT_EQ(other_value.get<ByteString>(), "bar");
EXPECT_EQ(other_value.get<0>(), 2);
EXPECT_EQ(other_value.get<1>(), "bar");
// Move ctor
auto moved_to_value { move(value) };
EXPECT_EQ(moved_to_value.get<int>(), 2);
EXPECT_EQ(moved_to_value.get<DeprecatedString>(), "bar");
EXPECT_EQ(moved_to_value.get<ByteString>(), "bar");
EXPECT_EQ(moved_to_value.get<0>(), 2);
EXPECT_EQ(moved_to_value.get<1>(), "bar");
// Copy assignment
value = moved_to_value;
EXPECT_EQ(moved_to_value.get<int>(), 2);
EXPECT_EQ(moved_to_value.get<DeprecatedString>(), "bar");
EXPECT_EQ(moved_to_value.get<ByteString>(), "bar");
EXPECT_EQ(moved_to_value.get<0>(), 2);
EXPECT_EQ(moved_to_value.get<1>(), "bar");
EXPECT_EQ(value.get<int>(), 2);
EXPECT_EQ(value.get<DeprecatedString>(), "bar");
EXPECT_EQ(value.get<ByteString>(), "bar");
EXPECT_EQ(value.get<0>(), 2);
EXPECT_EQ(value.get<1>(), "bar");
}
@ -68,12 +68,12 @@ TEST_CASE(no_copy)
TEST_CASE(apply)
{
Tuple<int, int, DeprecatedString> args { 1, 2, "foo" };
Tuple<int, int, ByteString> args { 1, 2, "foo" };
// With copy
{
bool was_called = false;
args.apply_as_args([&](int a, int b, DeprecatedString c) {
args.apply_as_args([&](int a, int b, ByteString c) {
was_called = true;
EXPECT_EQ(a, 1);
EXPECT_EQ(b, 2);
@ -85,7 +85,7 @@ TEST_CASE(apply)
// With reference
{
bool was_called = false;
args.apply_as_args([&](int& a, int& b, DeprecatedString& c) {
args.apply_as_args([&](int& a, int& b, ByteString& c) {
was_called = true;
EXPECT_EQ(a, 1);
EXPECT_EQ(b, 2);
@ -98,7 +98,7 @@ TEST_CASE(apply)
{
bool was_called = false;
auto const& args_ref = args;
args_ref.apply_as_args([&](int const& a, int const& b, DeprecatedString const& c) {
args_ref.apply_as_args([&](int const& a, int const& b, ByteString const& c) {
was_called = true;
EXPECT_EQ(a, 1);
EXPECT_EQ(b, 2);