aboutsummaryrefslogtreecommitdiff
path: root/src/test/fs_tests.cpp
diff options
context:
space:
mode:
authorKiminuo <kiminuo@protonmail.com>2020-06-11 08:58:46 +0200
committerfanquake <fanquake@gmail.com>2022-02-03 18:35:52 +0800
commit41d7166c8a598b604aad6c6b1d88ad46e23be247 (patch)
tree883af805ab387dc7db01602a19ccd70d89b78cb1 /src/test/fs_tests.cpp
parentffc89d1f21258553c0087b774a9ea1ce84139d4f (diff)
downloadbitcoin-41d7166c8a598b604aad6c6b1d88ad46e23be247.tar.xz
refactor: replace boost::filesystem with std::filesystem
Warning: Replacing fs::system_complete calls with fs::absolute calls in this commit may cause minor changes in behaviour because fs::absolute no longer strips trailing slashes; however these changes are believed to be safe. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Diffstat (limited to 'src/test/fs_tests.cpp')
-rw-r--r--src/test/fs_tests.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/test/fs_tests.cpp b/src/test/fs_tests.cpp
index d3389c30eb..1256395849 100644
--- a/src/test/fs_tests.cpp
+++ b/src/test/fs_tests.cpp
@@ -9,6 +9,10 @@
#include <boost/test/unit_test.hpp>
+#include <fstream>
+#include <ios>
+#include <string>
+
BOOST_FIXTURE_TEST_SUITE(fs_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(fsbridge_pathtostring)
@@ -45,37 +49,37 @@ BOOST_AUTO_TEST_CASE(fsbridge_fstream)
fs::path tmpfile1 = tmpfolder / "fs_tests_₿_🏃";
fs::path tmpfile2 = tmpfolder / "fs_tests_₿_🏃";
{
- fsbridge::ofstream file(tmpfile1);
+ std::ofstream file{tmpfile1};
file << "bitcoin";
}
{
- fsbridge::ifstream file(tmpfile2);
+ std::ifstream file{tmpfile2};
std::string input_buffer;
file >> input_buffer;
BOOST_CHECK_EQUAL(input_buffer, "bitcoin");
}
{
- fsbridge::ifstream file(tmpfile1, std::ios_base::in | std::ios_base::ate);
+ std::ifstream file{tmpfile1, std::ios_base::in | std::ios_base::ate};
std::string input_buffer;
file >> input_buffer;
BOOST_CHECK_EQUAL(input_buffer, "");
}
{
- fsbridge::ofstream file(tmpfile2, std::ios_base::out | std::ios_base::app);
+ std::ofstream file{tmpfile2, std::ios_base::out | std::ios_base::app};
file << "tests";
}
{
- fsbridge::ifstream file(tmpfile1);
+ std::ifstream file{tmpfile1};
std::string input_buffer;
file >> input_buffer;
BOOST_CHECK_EQUAL(input_buffer, "bitcointests");
}
{
- fsbridge::ofstream file(tmpfile2, std::ios_base::out | std::ios_base::trunc);
+ std::ofstream file{tmpfile2, std::ios_base::out | std::ios_base::trunc};
file << "bitcoin";
}
{
- fsbridge::ifstream file(tmpfile1);
+ std::ifstream file{tmpfile1};
std::string input_buffer;
file >> input_buffer;
BOOST_CHECK_EQUAL(input_buffer, "bitcoin");