45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#include "framework.h"
|
|||
|
|
|
||
|
|
#include <cstdlib>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
namespace clients_test {
|
||
|
|
|
||
|
|
int run_all() {
|
||
|
|
// Loopback tests must never be proxied; proxy tests set their own env.
|
||
|
|
unsetenv("HTTP_PROXY");
|
||
|
|
unsetenv("HTTPS_PROXY");
|
||
|
|
unsetenv("NO_PROXY");
|
||
|
|
unsetenv("http_proxy");
|
||
|
|
unsetenv("https_proxy");
|
||
|
|
unsetenv("no_proxy");
|
||
|
|
int passed = 0;
|
||
|
|
int failed = 0;
|
||
|
|
for (const auto& test : registry()) {
|
||
|
|
try {
|
||
|
|
test.fn();
|
||
|
|
++passed;
|
||
|
|
std::cout << "ok " << test.suite << "." << test.name << "\n";
|
||
|
|
} catch (const Failure& err) {
|
||
|
|
++failed;
|
||
|
|
std::cout << "FAIL " << test.suite << "." << test.name << ": " << err.what()
|
||
|
|
<< "\n";
|
||
|
|
} catch (const std::exception& err) {
|
||
|
|
++failed;
|
||
|
|
std::cout << "FAIL " << test.suite << "." << test.name
|
||
|
|
<< ": uncaught std::exception: " << err.what() << "\n";
|
||
|
|
} catch (...) {
|
||
|
|
++failed;
|
||
|
|
std::cout << "FAIL " << test.suite << "." << test.name
|
||
|
|
<< ": uncaught unknown exception\n";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
std::cout << "passed " << passed << " failed " << failed << " total "
|
||
|
|
<< (passed + failed) << "\n";
|
||
|
|
return failed == 0 ? 0 : 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace clients_test
|
||
|
|
|
||
|
|
int main() { return clients_test::run_all(); }
|