aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-10-05 21:41:32 +0800
committercrupest <crupest@outlook.com>2023-10-05 21:41:32 +0800
commita5d07d55ef4395a5836fd0d2cd86b94290cb2d07 (patch)
tree93559c7402df97171b84e43a67aef82d36552da1 /test
parentc1f491712ab071030ed8ca9587c896ca2856ab97 (diff)
downloadcru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.tar.gz
cru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.tar.bz2
cru-a5d07d55ef4395a5836fd0d2cd86b94290cb2d07.zip
...
Diffstat (limited to 'test')
-rw-r--r--test/common/platform/unix/UnixFileStreamTest.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/common/platform/unix/UnixFileStreamTest.cpp b/test/common/platform/unix/UnixFileStreamTest.cpp
index b9ff40da..c27e485b 100644
--- a/test/common/platform/unix/UnixFileStreamTest.cpp
+++ b/test/common/platform/unix/UnixFileStreamTest.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
-#include <cstdio>
+#include <fcntl.h>
#include <filesystem>
TEST_CASE("UnixFileStream Work", "[stream]") {
@@ -16,13 +16,11 @@ TEST_CASE("UnixFileStream Work", "[stream]") {
.generic_string();
mktemp(temp_file_path.data());
- String path = String::FromUtf8(temp_file_path);
-
- UnixFileStream file(path, OpenFileFlags::Write | OpenFileFlags::Create);
+ UnixFileStream file(temp_file_path.c_str(), O_WRONLY | O_CREAT);
file.Write("abc", 3);
file.Close();
- UnixFileStream file2(path, OpenFileFlags::Read);
+ UnixFileStream file2(temp_file_path.c_str(), OpenFileFlags::Read);
auto buffer = std::make_unique<std::byte[]>(3);
file2.Read(buffer.get(), 3);
REQUIRE(std::string_view(reinterpret_cast<const char*>(buffer.get()), 3) ==