From 251de730edd53a03aac48a7ec79dbce21d05ab3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 21 Jul 2021 15:10:51 +0200 Subject: [PATCH] CommonIO: Use a macro to construct TemporaryDirectory prefix --- test/libsolutil/CommonIO.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/libsolutil/CommonIO.cpp b/test/libsolutil/CommonIO.cpp index 57fea38de..a0edb76b4 100644 --- a/test/libsolutil/CommonIO.cpp +++ b/test/libsolutil/CommonIO.cpp @@ -34,6 +34,8 @@ using namespace std; using namespace solidity::test; +#define TEST_CASE_NAME (boost::unit_test::framework::current_test_case().p_name) + namespace solidity::util::test { @@ -41,7 +43,7 @@ BOOST_AUTO_TEST_SUITE(CommonIOTest) BOOST_AUTO_TEST_CASE(readFileAsString_regular_file) { - TemporaryDirectory tempDir("common-io-test-"); + TemporaryDirectory tempDir(TEST_CASE_NAME); createFileWithContent(tempDir.path() / "test.txt", "ABC\ndef\n"); BOOST_TEST(readFileAsString(tempDir.path() / "test.txt") == "ABC\ndef\n"); @@ -49,13 +51,13 @@ BOOST_AUTO_TEST_CASE(readFileAsString_regular_file) BOOST_AUTO_TEST_CASE(readFileAsString_directory) { - TemporaryDirectory tempDir("common-io-test-"); + TemporaryDirectory tempDir(TEST_CASE_NAME); BOOST_CHECK_THROW(readFileAsString(tempDir.path()), NotAFile); } BOOST_AUTO_TEST_CASE(readFileAsString_symlink) { - TemporaryDirectory tempDir("common-io-test-"); + TemporaryDirectory tempDir(TEST_CASE_NAME); createFileWithContent(tempDir.path() / "test.txt", "ABC\ndef\n"); if (!createSymlinkIfSupportedByFilesystem("test.txt", tempDir.path() / "symlink.txt", false))