Skip to content

Commit fb6a257

Browse files
committed
TemporaryDirectory: Automatically add a dash after the prefix
1 parent 251de73 commit fb6a257

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

test/TemporaryDirectory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ using namespace solidity::test;
3131
namespace fs = boost::filesystem;
3232

3333
TemporaryDirectory::TemporaryDirectory(std::string const& _prefix):
34-
m_path(fs::temp_directory_path() / fs::unique_path(_prefix + "%%%%-%%%%-%%%%-%%%%"))
34+
m_path(fs::temp_directory_path() / fs::unique_path(_prefix + "-%%%%-%%%%-%%%%-%%%%"))
3535
{
3636
// Prefix should just be a file name and not contain anything that would make us step out of /tmp.
3737
assert(fs::path(_prefix) == fs::path(_prefix).stem());

test/TemporaryDirectory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace solidity::test
4040
class TemporaryDirectory
4141
{
4242
public:
43-
TemporaryDirectory(std::string const& _prefix = "solidity-test-");
43+
TemporaryDirectory(std::string const& _prefix = "solidity-test");
4444
~TemporaryDirectory();
4545

4646
boost::filesystem::path const& path() const { return m_path; }

test/TemporaryDirectoryTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ BOOST_AUTO_TEST_CASE(TemporaryDirectory_should_create_and_delete_a_unique_and_em
3737
{
3838
fs::path dirPath;
3939
{
40-
TemporaryDirectory tempDir("temporary-directory-test-");
40+
TemporaryDirectory tempDir("temporary-directory-test");
4141
dirPath = tempDir.path();
4242

43-
BOOST_TEST(dirPath.stem().string().find("temporary-directory-test-") == 0);
43+
BOOST_TEST(dirPath.stem().string().find("temporary-directory-test") == 0);
4444
BOOST_TEST(fs::equivalent(dirPath.parent_path(), fs::temp_directory_path()));
4545
BOOST_TEST(fs::is_directory(dirPath));
4646
BOOST_TEST(fs::is_empty(dirPath));
@@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(TemporaryDirectory_should_delete_its_directory_even_if_not_
5252
{
5353
fs::path dirPath;
5454
{
55-
TemporaryDirectory tempDir("temporary-directory-test-");
55+
TemporaryDirectory tempDir("temporary-directory-test");
5656
dirPath = tempDir.path();
5757

5858
BOOST_TEST(fs::is_directory(dirPath));
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(TemporaryWorkingDirectory_should_change_and_restore_working
7373
try
7474
{
7575
{
76-
TemporaryDirectory tempDir("temporary-directory-test-");
76+
TemporaryDirectory tempDir("temporary-directory-test");
7777
assert(fs::equivalent(fs::current_path(), originalWorkingDirectory));
7878
assert(!fs::equivalent(tempDir.path(), originalWorkingDirectory));
7979

0 commit comments

Comments
 (0)