mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:47:35 +00:00
AK: Use an enum to specify the open mode instead of a bool
Let's replace this bool with an `enum class` in order to enhance readability. This is done by repurposing `MappedFile`'s `OpenMode` into a shared `enum` simply called `Mode`.
This commit is contained in:
parent
00ad8419cf
commit
b00476abac
7 changed files with 24 additions and 25 deletions
|
@ -259,7 +259,7 @@ TEST_CASE(fixed_memory_read_in_place)
|
|||
EXPECT_EQ(characters, some_words.bytes());
|
||||
EXPECT(readonly_stream.is_eof());
|
||||
|
||||
FixedMemoryStream mutable_stream { Bytes { const_cast<u8*>(some_words.bytes().data()), some_words.bytes().size() }, true };
|
||||
FixedMemoryStream mutable_stream { Bytes { const_cast<u8*>(some_words.bytes().data()), some_words.bytes().size() }, FixedMemoryStream::Mode::ReadWrite };
|
||||
// Trying to read mutable values from a mutable stream should succeed.
|
||||
TRY_OR_FAIL(mutable_stream.read_in_place<u8>(1));
|
||||
EXPECT_EQ(mutable_stream.offset(), 1u);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue