Skip to content

Commit 251de73

Browse files
committed
CommonIO: Use a macro to construct TemporaryDirectory prefix
1 parent 13f46eb commit 251de73

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/libsolutil/CommonIO.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,30 @@
3434
using namespace std;
3535
using namespace solidity::test;
3636

37+
#define TEST_CASE_NAME (boost::unit_test::framework::current_test_case().p_name)
38+
3739
namespace solidity::util::test
3840
{
3941

4042
BOOST_AUTO_TEST_SUITE(CommonIOTest)
4143

4244
BOOST_AUTO_TEST_CASE(readFileAsString_regular_file)
4345
{
44-
TemporaryDirectory tempDir("common-io-test-");
46+
TemporaryDirectory tempDir(TEST_CASE_NAME);
4547
createFileWithContent(tempDir.path() / "test.txt", "ABC\ndef\n");
4648

4749
BOOST_TEST(readFileAsString(tempDir.path() / "test.txt") == "ABC\ndef\n");
4850
}
4951

5052
BOOST_AUTO_TEST_CASE(readFileAsString_directory)
5153
{
52-
TemporaryDirectory tempDir("common-io-test-");
54+
TemporaryDirectory tempDir(TEST_CASE_NAME);
5355
BOOST_CHECK_THROW(readFileAsString(tempDir.path()), NotAFile);
5456
}
5557

5658
BOOST_AUTO_TEST_CASE(readFileAsString_symlink)
5759
{
58-
TemporaryDirectory tempDir("common-io-test-");
60+
TemporaryDirectory tempDir(TEST_CASE_NAME);
5961
createFileWithContent(tempDir.path() / "test.txt", "ABC\ndef\n");
6062

6163
if (!createSymlinkIfSupportedByFilesystem("test.txt", tempDir.path() / "symlink.txt", false))

0 commit comments

Comments
 (0)