[ox] Make tests more consistent
This commit is contained in:
16
deps/ox/src/ox/event/test/tests.cpp
vendored
16
deps/ox/src/ox/event/test/tests.cpp
vendored
@@ -21,7 +21,7 @@ struct TestStruct: public ox::SignalHandler {
|
||||
}
|
||||
};
|
||||
|
||||
std::map<std::string, std::function<ox::Error()>> tests = {
|
||||
std::map<ox::StringView, std::function<ox::Error()>> tests = {
|
||||
{
|
||||
"test1",
|
||||
[] {
|
||||
@@ -39,12 +39,14 @@ std::map<std::string, std::function<ox::Error()>> tests = {
|
||||
};
|
||||
|
||||
int main(int argc, const char **args) {
|
||||
if (argc > 1) {
|
||||
auto testName = args[1];
|
||||
if (tests.find(testName) != tests.end()) {
|
||||
oxAssert(tests[testName](), "Test returned Error");
|
||||
return 0;
|
||||
}
|
||||
if (argc < 2) {
|
||||
oxError("Must specify test to run");
|
||||
}
|
||||
auto const testName = args[1];
|
||||
auto const func = tests.find(testName);
|
||||
if (func != tests.end()) {
|
||||
oxAssert(func->second(), "Test returned Error");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user