Skip to content

Commit

Permalink
Fix temporary database file deletion.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent 85b8a00 commit 4ca5af4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions impeller/archivist/archivist_fixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,30 @@ namespace testing {

ArchivistFixture::ArchivistFixture() {
std::stringstream stream;
stream << flutter::testing::GetCurrentTestName() << ".db";
archive_file_name_ = fml::paths::JoinPaths(
{flutter::testing::GetFixturesPath(), stream.str()});
stream << "Test" << flutter::testing::GetCurrentTestName() << ".db";
archive_file_name_ = stream.str();
}

ArchivistFixture::~ArchivistFixture() = default;

const std::string ArchivistFixture::GetArchiveFileName() const {
return archive_file_name_;
return fml::paths::JoinPaths(
{flutter::testing::GetFixturesPath(), archive_file_name_});
}

void ArchivistFixture::SetUp() {
DeleteArchiveFile();
}

void ArchivistFixture::TearDown() {
// TODO: Tear this down. For now, I am inspecting the files for readability of
// schema.
// DeleteArchiveFile();
DeleteArchiveFile();
}

void ArchivistFixture::DeleteArchiveFile() const {
fml::UnlinkFile(archive_file_name_.c_str());
auto fixtures = flutter::testing::OpenFixturesDirectory();
if (fml::FileExists(fixtures, archive_file_name_.c_str())) {
fml::UnlinkFile(fixtures, archive_file_name_.c_str());
}
}

} // namespace testing
Expand Down

0 comments on commit 4ca5af4

Please sign in to comment.