Merge pull request #11650 from ethereum/boost-path-in-read-file-as-string

Use `boost::filesystem::path` in `readFileAsString()`
This commit is contained in:
Kamil Śliwak
2021-08-20 19:45:54 +02:00
committed by GitHub
9 changed files with 26 additions and 28 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ pair<SourceMap, size_t> TestCaseReader::parseSourcesAndSettingsWithLineNumber(is
if (!fs::exists(externalSourceFullPath))
BOOST_THROW_EXCEPTION(runtime_error("External Source '" + externalSourceTarget.string() + "' not found."));
else
externalSourceContent = util::readFileAsString(externalSourceFullPath.string());
externalSourceContent = util::readFileAsString(externalSourceFullPath);
if (sources.count(externalSourceName))
BOOST_THROW_EXCEPTION(runtime_error("Multiple definitions of test source \"" + externalSourceName + "\"."));
+3 -3
View File
@@ -44,13 +44,13 @@ BOOST_AUTO_TEST_CASE(readFileAsString_regular_file)
TemporaryDirectory tempDir("common-io-test-");
createFileWithContent(tempDir.path() / "test.txt", "ABC\ndef\n");
BOOST_TEST(readFileAsString((tempDir.path() / "test.txt").string()) == "ABC\ndef\n");
BOOST_TEST(readFileAsString(tempDir.path() / "test.txt") == "ABC\ndef\n");
}
BOOST_AUTO_TEST_CASE(readFileAsString_directory)
{
TemporaryDirectory tempDir("common-io-test-");
BOOST_CHECK_THROW(readFileAsString(tempDir.path().string()), NotAFile);
BOOST_CHECK_THROW(readFileAsString(tempDir.path()), NotAFile);
}
BOOST_AUTO_TEST_CASE(readFileAsString_symlink)
@@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(readFileAsString_symlink)
if (!createSymlinkIfSupportedByFilesystem("test.txt", tempDir.path() / "symlink.txt"))
return;
BOOST_TEST(readFileAsString((tempDir.path() / "symlink.txt").string()) == "ABC\ndef\n");
BOOST_TEST(readFileAsString(tempDir.path() / "symlink.txt") == "ABC\ndef\n");
}
BOOST_AUTO_TEST_SUITE_END()