Add documentation/specification for ConfigurationManager

Add documentation testing to ConfigurationManager
This commit is contained in:
Alexander Bock
2016-09-14 17:49:17 +02:00
parent d84a0ee46a
commit 3ddbb44524
6 changed files with 352 additions and 2 deletions
+14 -1
View File
@@ -32,6 +32,8 @@
using std::string;
#include "configurationmanager_doc.inl"
namespace {
const string _configurationFile = "openspace.cfg";
const string _keyBasePath = "BASE_PATH";
@@ -94,8 +96,9 @@ string ConfigurationManager::findConfiguration(const string& filename) {
void ConfigurationManager::loadFromFile(const string& filename) {
using ghoul::filesystem::FileSystem;
if (!FileSys.fileExists(filename))
if (!FileSys.fileExists(filename)) {
throw ghoul::FileNotFoundError(filename, "ConfigurationManager");
}
// ${BASE_PATH}
string basePathToken = FileSystem::TokenOpeningBraces + _keyBasePath
@@ -109,6 +112,16 @@ void ConfigurationManager::loadFromFile(const string& filename) {
// Loading the configuration file into ourselves
ghoul::lua::loadDictionaryFromFile(filename, *this);
// Perform testing against the documentation/specification
using namespace openspace::documentation;
TestResult result = testSpecification(
Documented<ConfigurationManager>::Documentation(),
*this
);
if (!result.success) {
throw SpecificationError(result, "ConfigurationManager");
}
// Register all the paths
ghoul::Dictionary dictionary = value<ghoul::Dictionary>(KeyPaths);