MCPcopy Create free account
hub / github.com/KDE/kdevelop / testReadAndSetConfigOption

Method testReadAndSetConfigOption

plugins/git/tests/test_git.cpp:274–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void GitInitTest::testReadAndSetConfigOption()
275{
276 repoInit();
277
278 {
279 qDebug() << "read non-existing config option";
280 QString nameFromPlugin = m_plugin->readConfigOption(QUrl::fromLocalFile(gitTest_BaseDir()),
281 QStringLiteral("notexisting.asdads"));
282 QVERIFY(nameFromPlugin.isEmpty());
283 }
284
285 {
286 qDebug() << "write user.name = \"John Tester\"";
287 auto job = m_plugin->setConfigOption(QUrl::fromLocalFile(gitTest_BaseDir()),
288 QStringLiteral("user.name"), QStringLiteral("John Tester"));
289 VERIFYJOB(job);
290 const auto name = runCommand(QStringLiteral("git"), {"config", "--get", QStringLiteral("user.name")});
291 QCOMPARE(name, QStringLiteral("John Tester"));
292 }
293
294 {
295 qDebug() << "read user.name";
296 const QString nameFromPlugin = m_plugin->readConfigOption(QUrl::fromLocalFile(gitTest_BaseDir()),
297 QStringLiteral("user.name"));
298 QCOMPARE(nameFromPlugin, QStringLiteral("John Tester"));
299 const auto name = runCommand(QStringLiteral("git"), {"config", "--get", QStringLiteral("user.name")});
300 QCOMPARE(name, QStringLiteral("John Tester"));
301 }
302}
303
304void GitInitTest::testAdd()
305{

Callers

nothing calls this directly

Calls 5

gitTest_BaseDirFunction · 0.85
runCommandFunction · 0.85
readConfigOptionMethod · 0.80
setConfigOptionMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected