mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
AK: Make "foo"_string infallible
Stop worrying about tiny OOMs. Work towards #20405.
This commit is contained in:
parent
db2a8725c6
commit
34344120f2
Notes:
sideshowbarker
2024-07-16 20:31:50 +09:00
Author: https://github.com/awesomekling
Commit: 34344120f2
Pull-request: https://github.com/SerenityOS/serenity/pull/20408
181 changed files with 626 additions and 630 deletions
|
@ -22,13 +22,13 @@ TEST_CASE(empty_string)
|
|||
|
||||
TEST_CASE(short_string)
|
||||
{
|
||||
FlyString fly1 { MUST("foo"_string) };
|
||||
FlyString fly1 { "foo"_string };
|
||||
EXPECT_EQ(fly1, "foo"sv);
|
||||
|
||||
FlyString fly2 { MUST("foo"_string) };
|
||||
FlyString fly2 { "foo"_string };
|
||||
EXPECT_EQ(fly2, "foo"sv);
|
||||
|
||||
FlyString fly3 { MUST("bar"_string) };
|
||||
FlyString fly3 { "bar"_string };
|
||||
EXPECT_EQ(fly3, "bar"sv);
|
||||
|
||||
EXPECT_EQ(fly1, fly2);
|
||||
|
@ -45,15 +45,15 @@ TEST_CASE(short_string)
|
|||
|
||||
TEST_CASE(long_string)
|
||||
{
|
||||
FlyString fly1 { MUST("thisisdefinitelymorethan7bytes"_string) };
|
||||
FlyString fly1 { "thisisdefinitelymorethan7bytes"_string };
|
||||
EXPECT_EQ(fly1, "thisisdefinitelymorethan7bytes"sv);
|
||||
EXPECT_EQ(FlyString::number_of_fly_strings(), 1u);
|
||||
|
||||
FlyString fly2 { MUST("thisisdefinitelymorethan7bytes"_string) };
|
||||
FlyString fly2 { "thisisdefinitelymorethan7bytes"_string };
|
||||
EXPECT_EQ(fly2, "thisisdefinitelymorethan7bytes"sv);
|
||||
EXPECT_EQ(FlyString::number_of_fly_strings(), 1u);
|
||||
|
||||
FlyString fly3 { MUST("thisisalsoforsuremorethan7bytes"_string) };
|
||||
FlyString fly3 { "thisisalsoforsuremorethan7bytes"_string };
|
||||
EXPECT_EQ(fly3, "thisisalsoforsuremorethan7bytes"sv);
|
||||
EXPECT_EQ(FlyString::number_of_fly_strings(), 2u);
|
||||
|
||||
|
@ -91,7 +91,7 @@ TEST_CASE(fly_string_keep_string_data_alive)
|
|||
{
|
||||
FlyString fly {};
|
||||
{
|
||||
auto string = MUST("thisisdefinitelymorethan7bytes"_string);
|
||||
auto string = "thisisdefinitelymorethan7bytes"_string;
|
||||
fly = FlyString { string };
|
||||
EXPECT_EQ(FlyString::number_of_fly_strings(), 1u);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ TEST_CASE(moved_fly_string_becomes_empty)
|
|||
FlyString fly1 {};
|
||||
EXPECT(fly1.is_empty());
|
||||
|
||||
FlyString fly2 { MUST("thisisdefinitelymorethan7bytes"_string) };
|
||||
FlyString fly2 { "thisisdefinitelymorethan7bytes"_string };
|
||||
EXPECT_EQ(fly2, "thisisdefinitelymorethan7bytes"sv);
|
||||
EXPECT_EQ(FlyString::number_of_fly_strings(), 1u);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue