mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Let the ReferencingVerifier fail gracefully if a referencing identifier is not found
This commit is contained in:
@@ -30,32 +30,33 @@
|
||||
#include <set>
|
||||
|
||||
namespace {
|
||||
// Structure used to make offenses unique
|
||||
struct OffenseCompare {
|
||||
using Offense = openspace::documentation::TestResult::Offense;
|
||||
bool operator()(const Offense& lhs, const Offense& rhs) const {
|
||||
if (lhs.offender != rhs.offender) {
|
||||
return lhs.offender < rhs.offender;
|
||||
}
|
||||
else {
|
||||
return std::underlying_type_t<Offense::Reason>(lhs.reason) <
|
||||
std::underlying_type_t<Offense::Reason>(rhs.reason);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct WarningCompare {
|
||||
using Warning = openspace::documentation::TestResult::Warning;
|
||||
bool operator()(const Warning& lhs, const Warning& rhs) const {
|
||||
if (lhs.offender != rhs.offender) {
|
||||
return lhs.offender < rhs.offender;
|
||||
}
|
||||
else {
|
||||
return std::underlying_type_t<Warning::Reason>(lhs.reason) <
|
||||
std::underlying_type_t<Warning::Reason>(rhs.reason);
|
||||
}
|
||||
// Structure used to make offenses unique
|
||||
struct OffenseCompare {
|
||||
using Offense = openspace::documentation::TestResult::Offense;
|
||||
bool operator()(const Offense& lhs, const Offense& rhs) const {
|
||||
if (lhs.offender != rhs.offender) {
|
||||
return lhs.offender < rhs.offender;
|
||||
}
|
||||
};
|
||||
else {
|
||||
return std::underlying_type_t<Offense::Reason>(lhs.reason) <
|
||||
std::underlying_type_t<Offense::Reason>(rhs.reason);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct WarningCompare {
|
||||
using Warning = openspace::documentation::TestResult::Warning;
|
||||
bool operator()(const Warning& lhs, const Warning& rhs) const {
|
||||
if (lhs.offender != rhs.offender) {
|
||||
return lhs.offender < rhs.offender;
|
||||
}
|
||||
else {
|
||||
return std::underlying_type_t<Warning::Reason>(lhs.reason) <
|
||||
std::underlying_type_t<Warning::Reason>(rhs.reason);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -225,10 +225,19 @@ TestResult ReferencingVerifier::operator()(const ghoul::Dictionary& dictionary,
|
||||
[this](const Documentation& doc) { return doc.id == identifier; }
|
||||
);
|
||||
|
||||
ghoul_assert(
|
||||
it != docs.end(),
|
||||
"Did not find referencing identifier '" + identifier + "'"
|
||||
);
|
||||
if (it == docs.end()) {
|
||||
res.offenses.push_back({
|
||||
key,
|
||||
TestResult::Offense::Reason::UnknownIdentifier
|
||||
});
|
||||
res.success = false;
|
||||
return res;
|
||||
}
|
||||
|
||||
//ghoul_assert(
|
||||
// it != docs.end(),
|
||||
// "Did not find referencing identifier '" + identifier + "'"
|
||||
//);
|
||||
|
||||
ghoul::Dictionary d = dictionary.value<ghoul::Dictionary>(key);
|
||||
TestResult r = testSpecification(*it, d);
|
||||
|
||||
Reference in New Issue
Block a user