|
18 | 18 |
|
19 | 19 | #include <test/TemporaryDirectory.h>
|
20 | 20 |
|
| 21 | +#include <test/libsolidity/util/SoltestErrors.h> |
| 22 | + |
21 | 23 | #include <boost/filesystem.hpp>
|
22 | 24 | #include <boost/test/unit_test.hpp>
|
23 | 25 |
|
|
26 | 28 | using namespace std;
|
27 | 29 | using namespace boost::test_tools;
|
28 | 30 |
|
29 |
| -namespace fs = boost::filesystem; |
30 |
| - |
31 | 31 | namespace solidity::test
|
32 | 32 | {
|
33 | 33 |
|
34 | 34 | BOOST_AUTO_TEST_SUITE(TemporaryDirectoryTest)
|
35 | 35 |
|
36 | 36 | BOOST_AUTO_TEST_CASE(TemporaryDirectory_should_create_and_delete_a_unique_and_empty_directory)
|
37 | 37 | {
|
38 |
| - fs::path dirPath; |
| 38 | + boost::filesystem::path dirPath; |
39 | 39 | {
|
40 | 40 | TemporaryDirectory tempDir("temporary-directory-test");
|
41 | 41 | dirPath = tempDir.path();
|
42 | 42 |
|
43 | 43 | BOOST_TEST(dirPath.stem().string().find("temporary-directory-test") == 0);
|
44 |
| - BOOST_TEST(fs::equivalent(dirPath.parent_path(), fs::temp_directory_path())); |
45 |
| - BOOST_TEST(fs::is_directory(dirPath)); |
46 |
| - BOOST_TEST(fs::is_empty(dirPath)); |
| 44 | + BOOST_TEST(boost::filesystem::equivalent(dirPath.parent_path(), boost::filesystem::temp_directory_path())); |
| 45 | + BOOST_TEST(boost::filesystem::is_directory(dirPath)); |
| 46 | + BOOST_TEST(boost::filesystem::is_empty(dirPath)); |
47 | 47 | }
|
48 |
| - BOOST_TEST(!fs::exists(dirPath)); |
| 48 | + BOOST_TEST(!boost::filesystem::exists(dirPath)); |
49 | 49 | }
|
50 | 50 |
|
51 | 51 | BOOST_AUTO_TEST_CASE(TemporaryDirectory_should_delete_its_directory_even_if_not_empty)
|
52 | 52 | {
|
53 |
| - fs::path dirPath; |
| 53 | + boost::filesystem::path dirPath; |
54 | 54 | {
|
55 | 55 | TemporaryDirectory tempDir("temporary-directory-test");
|
56 | 56 | dirPath = tempDir.path();
|
57 | 57 |
|
58 |
| - BOOST_TEST(fs::is_directory(dirPath)); |
| 58 | + BOOST_TEST(boost::filesystem::is_directory(dirPath)); |
59 | 59 |
|
60 | 60 | {
|
61 | 61 | ofstream tmpFile((dirPath / "test-file.txt").string());
|
62 | 62 | tmpFile << "Delete me!" << endl;
|
63 | 63 | }
|
64 |
| - assert(fs::is_regular_file(dirPath / "test-file.txt")); |
| 64 | + soltestAssert(boost::filesystem::is_regular_file(dirPath / "test-file.txt"), ""); |
65 | 65 | }
|
66 |
| - BOOST_TEST(!fs::exists(dirPath / "test-file.txt")); |
| 66 | + BOOST_TEST(!boost::filesystem::exists(dirPath / "test-file.txt")); |
67 | 67 | }
|
68 | 68 |
|
69 | 69 | BOOST_AUTO_TEST_CASE(TemporaryWorkingDirectory_should_change_and_restore_working_directory)
|
70 | 70 | {
|
71 |
| - fs::path originalWorkingDirectory = fs::current_path(); |
| 71 | + boost::filesystem::path originalWorkingDirectory = boost::filesystem::current_path(); |
72 | 72 |
|
73 | 73 | try
|
74 | 74 | {
|
75 | 75 | {
|
76 | 76 | TemporaryDirectory tempDir("temporary-directory-test");
|
77 |
| - assert(fs::equivalent(fs::current_path(), originalWorkingDirectory)); |
78 |
| - assert(!fs::equivalent(tempDir.path(), originalWorkingDirectory)); |
| 77 | + soltestAssert(boost::filesystem::equivalent(boost::filesystem::current_path(), originalWorkingDirectory), ""); |
| 78 | + soltestAssert(!boost::filesystem::equivalent(tempDir.path(), originalWorkingDirectory), ""); |
79 | 79 |
|
80 | 80 | TemporaryWorkingDirectory tempWorkDir(tempDir.path());
|
81 | 81 |
|
82 |
| - BOOST_TEST(fs::equivalent(fs::current_path(), tempDir.path())); |
| 82 | + BOOST_TEST(boost::filesystem::equivalent(boost::filesystem::current_path(), tempDir.path())); |
83 | 83 | }
|
84 |
| - BOOST_TEST(fs::equivalent(fs::current_path(), originalWorkingDirectory)); |
| 84 | + BOOST_TEST(boost::filesystem::equivalent(boost::filesystem::current_path(), originalWorkingDirectory)); |
85 | 85 |
|
86 |
| - fs::current_path(originalWorkingDirectory); |
| 86 | + boost::filesystem::current_path(originalWorkingDirectory); |
87 | 87 | }
|
88 | 88 | catch (...)
|
89 | 89 | {
|
90 |
| - fs::current_path(originalWorkingDirectory); |
| 90 | + boost::filesystem::current_path(originalWorkingDirectory); |
91 | 91 | }
|
92 | 92 | }
|
93 | 93 |
|
|
0 commit comments