mirror of
https://github.com/QuasarApp/CopyrightFixer.git
synced 2025-04-27 18:24:42 +00:00
ref #49 Added placeholder methods for unittests.
This commit is contained in:
parent
2a91765b29
commit
a9430cb657
@ -7,7 +7,6 @@
|
||||
|
||||
#include "configparser.h"
|
||||
#include <quasarapp.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace CopyrighFixer {
|
||||
@ -15,33 +14,34 @@ ConfigParser::ConfigParser() {
|
||||
|
||||
}
|
||||
|
||||
const Config ConfigParser::parseOptions(const Config &conf) const {
|
||||
|
||||
Config configOption = conf;
|
||||
bool ConfigParser::parseOptions(Config &conf) const {
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("sourceDir")) {
|
||||
configOption.setSourceDir(QuasarAppUtils::Params::getArg("sourceDir"));
|
||||
conf.setSourceDir(QuasarAppUtils::Params::getArg("sourceDir"));
|
||||
} else {
|
||||
std::cout << "Warning: Not option sourceDir" << std::endl;
|
||||
QuasarAppUtils::Params::log("Error: Not option sourceDir.",
|
||||
QuasarAppUtils::VerboseLvl::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("sign")) {
|
||||
Signature *signature = new Signature;
|
||||
configOption.setSingValue(*signature);
|
||||
// configOption.setSingValue(QuasarAppUtils::Params::getArg("sign"));
|
||||
Signature signature;
|
||||
conf.setSingValue(signature);
|
||||
}
|
||||
else {
|
||||
std::cout << "Warning: Not option sign" << std::endl;
|
||||
QuasarAppUtils::Params::log("Warning: Not option sign.",
|
||||
QuasarAppUtils::VerboseLvl::Warning);
|
||||
}
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("currentOwner")) {
|
||||
configOption.setCurrOwn(QuasarAppUtils::Params::getArg("currentOwner"));
|
||||
conf.setCurrOwn(QuasarAppUtils::Params::getArg("currentOwner"));
|
||||
} else {
|
||||
std::cout << "Warning: Not option currentOwner" << std::endl;
|
||||
QuasarAppUtils::Params::log("Warning: Not option currentOwner.",
|
||||
QuasarAppUtils::VerboseLvl::Warning);
|
||||
}
|
||||
|
||||
return configOption;
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
* @brief parseOptions This a method that will parse all input options.
|
||||
* @return The config object.
|
||||
*/
|
||||
const Config parseOptions(const Config &conf) const;
|
||||
bool parseOptions(Config &conf) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <QtTest>
|
||||
#include "cfixertest.h"
|
||||
#include "configparsertest.h"
|
||||
|
||||
// Use This macros for initialize your own test classes.
|
||||
// Check exampletests
|
||||
@ -31,6 +32,7 @@ private slots:
|
||||
|
||||
// BEGIN TESTS CASES
|
||||
TestCase(exampleTest, ExampleTest)
|
||||
TestCase(configParserTest, ConfigParserTest)
|
||||
// END TEST CASES
|
||||
|
||||
private:
|
||||
|
20
tests/units/configparsertest.cpp
Normal file
20
tests/units/configparsertest.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "configparsertest.h"
|
||||
|
||||
ConfigParserTest::ConfigParserTest() {
|
||||
|
||||
}
|
||||
|
||||
void ConfigParserTest::test() {
|
||||
testParsOpt();
|
||||
}
|
||||
|
||||
void ConfigParserTest::testParsOpt() {
|
||||
|
||||
}
|
25
tests/units/configparsertest.h
Normal file
25
tests/units/configparsertest.h
Normal file
@ -0,0 +1,25 @@
|
||||
//#
|
||||
//# Copyright (C) 2020-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef CONFIGPARSERTEST_H
|
||||
#define CONFIGPARSERTEST_H
|
||||
#include "test.h"
|
||||
#include "testutils.h"
|
||||
#include "CopyrighFixer/configparser.h"
|
||||
|
||||
|
||||
class ConfigParserTest: public Test, protected TestUtils {
|
||||
public:
|
||||
ConfigParserTest();
|
||||
~ConfigParserTest();
|
||||
|
||||
void test();
|
||||
void testParsOpt();
|
||||
|
||||
};
|
||||
|
||||
#endif // CONFIGPARSERTEST_H
|
Loading…
x
Reference in New Issue
Block a user