Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 6: [PATCH 06/17] feat(wallet): preserve Roots signing and spend controls on v31

src/test/fs_tests.cpp

Before: src/test/fs_tests.cpp · After: src/test/fs_tests.cpp

File metadata
index 7fd1de00e02bd9cbdaf057ad56d6d1abdfbee412..988ab18d08dfd72c1e91717ff072c9578e38cb9b 100644

Download original patch · Release notes

Diff rows 1–29 of 29. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/test/fs_tests.cpp CHANGED
@@ -12,8 +12,29 @@
12
  #include <ios>
13
  #include <string>
14
 
 
 
 
 
15
  BOOST_FIXTURE_TEST_SUITE(fs_tests, BasicTestingSetup)
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  BOOST_AUTO_TEST_CASE(fsbridge_pathtostring)
18
  {
19
  std::string u8_str = "fs_tests_₿_🏃";
 
12
  #include <ios>
13
  #include <string>
14
 
15
+ #ifndef WIN32
16
+ #include <unistd.h>
17
+ #endif
18
+
19
  BOOST_FIXTURE_TEST_SUITE(fs_tests, BasicTestingSetup)
20
 
21
+ BOOST_AUTO_TEST_CASE(directory_write_probe)
22
+ {
23
+ const fs::path dir{m_args.GetDataDirBase() / "write_probe"};
24
+ fs::create_directory(dir);
25
+ BOOST_CHECK(IsDirWritable(dir));
26
+ BOOST_CHECK(fs::is_empty(dir));
27
+ const fs::path file{dir / "file"};
28
+ { std::ofstream stream{file.std_path()}; }
29
+ BOOST_CHECK_THROW(IsDirWritable(file), std::runtime_error);
30
+ #ifndef WIN32
31
+ fs::permissions(dir, fs::perms::owner_read | fs::perms::owner_exec);
32
+ if (geteuid() != 0) BOOST_CHECK(!IsDirWritable(dir));
33
+ fs::permissions(dir, fs::perms::owner_all);
34
+ #endif
35
+ fs::remove_all(dir);
36
+ }
37
+
38
  BOOST_AUTO_TEST_CASE(fsbridge_pathtostring)
39
  {
40
  std::string u8_str = "fs_tests_₿_🏃";