summaryrefslogtreecommitdiff
path: root/Tests/LibC/TestLibCMkTemp.cpp
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2022-03-23 16:36:03 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-24 11:57:51 +0100
commit4a57be824cc6d4fed95f182431ba807b2327395e (patch)
tree6f0185eb39bbf6cd199d30decd63bdbae655c3bb /Tests/LibC/TestLibCMkTemp.cpp
parent10093a67732431924fc76145443ffac157b50e01 (diff)
downloadserenity-4a57be824cc6d4fed95f182431ba807b2327395e.zip
Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to ErrorOr<String>. The rest of the change is to support the potential of an Error being returned and subsequent release of the value when no Error is returned. Unfortunately at this stage none of the places affected can utililize our TRY() macro.
Diffstat (limited to 'Tests/LibC/TestLibCMkTemp.cpp')
-rw-r--r--Tests/LibC/TestLibCMkTemp.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Tests/LibC/TestLibCMkTemp.cpp b/Tests/LibC/TestLibCMkTemp.cpp
index 5045640a86..03d377642b 100644
--- a/Tests/LibC/TestLibCMkTemp.cpp
+++ b/Tests/LibC/TestLibCMkTemp.cpp
@@ -86,7 +86,10 @@ TEST_CASE(test_mkstemp_unique_filename)
auto fd = mkstemp(path);
EXPECT_NE(fd, -1);
- auto temp_path = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto temp_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
+ EXPECT(!temp_path_or_error.is_error());
+
+ auto temp_path = temp_path_or_error.release_value();
EXPECT(temp_path.characters());
close(fd);
@@ -104,7 +107,10 @@ TEST_CASE(test_mkstemp_unique_filename)
auto fd = mkstemp(path);
EXPECT(fd != -1);
- auto path2 = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
+ auto path2_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd));
+ EXPECT(!path2_or_error.is_error());
+
+ auto path2 = path2_or_error.release_value();
EXPECT(path2.characters());
close(fd);