MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / testSettingsPathCreation

Function testSettingsPathCreation

test/Settings.cpp:157–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155{
156
157void testSettingsPathCreation(const IApplicationContext& context, const std::string& versionString)
158{
159 settings::MajorMinorVersion version(versionString.empty() ? RADIANT_VERSION : versionString);
160
161 auto expectedFolder = os::standardPathWithSlash(context.getSettingsPath() + version.toString());
162
163 // Let's assume the folder doesn't exist yet
164 EXPECT_FALSE(fs::is_directory(expectedFolder)) << "The output path " << expectedFolder << " already exists";
165
166 // Set up a manager and check if it created the settings output folder
167 auto manager = versionString.empty() ?
168 std::make_unique<settings::SettingsManager>(context) :
169 std::make_unique<settings::SettingsManager>(context, versionString);
170
171 EXPECT_EQ(manager->getCurrentVersionSettingsFolder(), expectedFolder) << "Output folder is not what we expected";
172 EXPECT_TRUE(fs::is_directory(expectedFolder)) << "Manager should have created the path " << expectedFolder;
173
174 os::removeDirectory(expectedFolder);
175}
176
177}
178

Callers 1

TESTFunction · 0.85

Calls 5

removeDirectoryFunction · 0.85
standardPathWithSlashFunction · 0.50
emptyMethod · 0.45
getSettingsPathMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected