[generator][tests] Added ScopedDirCleanup helper.

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako
2025-09-08 00:19:39 -03:00
committed by Konstantin Pastbin
parent 0c079f5120
commit e7987a14c0
6 changed files with 38 additions and 31 deletions

View File

@@ -73,19 +73,18 @@ void TestMaxspeedsSection(Features const & roads, string const & maxspeedsCsvCon
FeatureIdToOsmId const & featureIdToOsmId)
{
classificator::Load();
string const testDirFullPath = base::JoinPath(GetPlatform().WritableDir(), kTestDir);
ScopedDir testScopedDir(kTestDir);
ScopedDirCleanup testScopedDir(testDirFullPath);
// Writing |maxspeedsCsvContent| to a file in |kTestDir|.
ScopedFile testScopedMaxspeedsCsv(base::JoinPath(kTestDir, kCsv), maxspeedsCsvContent);
// Writing |roads| to test mwm.
LocalCountryFile country(testDirFullPath, CountryFile(kTestMwm), 1 /* version */);
string const testMwm = kTestMwm + DATA_FILE_EXTENSION;
ScopedFile testScopedMwm(base::JoinPath(kTestDir, testMwm), ScopedFile::Mode::Create);
BuildGeometry(roads, country);
string const testMwmFullPath = base::JoinPath(testDirFullPath, testMwm);
string const testMwmFullPath = base::JoinPath(testDirFullPath, kTestMwm + DATA_FILE_EXTENSION);
// Create routing graph for test mwm.
auto const countryParentGetter = [](std::string const &) { return string(); };