Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/DefaultFileSystem.cpp

Issue 29481704: Noissue - Use buffer for FileSystem IO (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created July 6, 2017, 9:19 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/DefaultFileSystem.cpp
===================================================================
--- a/test/DefaultFileSystem.cpp
+++ b/test/DefaultFileSystem.cpp
@@ -21,30 +21,28 @@
namespace
{
const std::string testPath = "libadblockplus-t\xc3\xa4st-file";
void WriteString(AdblockPlus::FileSystem& fileSystem,
const std::string& content)
{
- std::stringstream input;
- input << content;
- fileSystem.Write(testPath, input);
+ AdblockPlus::FileSystem::IOBuffer buffer(content.cbegin(), content.cend());
+ fileSystem.Write(testPath, buffer);
}
}
TEST(DefaultFileSystemTest, WriteReadRemove)
{
AdblockPlus::DefaultFileSystem fileSystem;
WriteString(fileSystem, "foo");
- std::stringstream output;
- output << fileSystem.Read(testPath)->rdbuf();
+ auto output = fileSystem.Read(testPath);
fileSystem.Remove(testPath);
- ASSERT_EQ("foo", output.str());
+ ASSERT_EQ("foo", std::string(output.cbegin(), output.cend()));
}
TEST(DefaultFileSystemTest, StatWorkingDirectory)
{
AdblockPlus::DefaultFileSystem fileSystem;
const AdblockPlus::FileSystem::StatResult result = fileSystem.Stat(".");
ASSERT_TRUE(result.exists);
ASSERT_TRUE(result.isDirectory);
« src/DefaultFileSystem.cpp ('K') | « test/BaseJsTest.h ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld