1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

[tools.testspr] move file testspr/test.sh -> tools/testspr/test.sh

This commit is contained in:
bolero-MURAKAMI 2013-09-26 22:43:57 +09:00
parent 6a58eade0e
commit 3fef178b7c
11 changed files with 374 additions and 159 deletions

View file

@ -14,13 +14,40 @@
# error undefined TESTSPR_TEST_FUNCTION
#endif
#include <cstdlib>
#include <exception>
#include <iostream>
#include <sprout/preprocessor/stringize.hpp>
#include <testspr/assert.hpp>
#include <testspr/typeinfo.hpp>
int main() {
std::cout << "testspr exec: " << SPROUT_PP_STRINGIZE(TESTSPR_TEST_FUNCTION) << std::endl;
TESTSPR_TEST_FUNCTION();
std::cout << "testspr succeeded." << std::endl;
std::cout << "testspr exec(" << SPROUT_PP_STRINGIZE(TESTSPR_TEST_FUNCTION) << "):" << std::endl;
try {
TESTSPR_TEST_FUNCTION();
} catch (testspr::assertion_failed const& e) {
std::cout
<< " testspr failed." << std::endl
<< " " << e.what() << std::endl
;
return EXIT_FAILURE;
} catch (std::exception const& e) {
std::cout
<< " testspr failed for some reason." << std::endl
<< " exception handled:" << std::endl
<< " type = " << testspr::typename_of(e) << std::endl
<< " what = " << e.what() << std::endl
;
return EXIT_FAILURE;
} catch (...) {
std::cout
<< " testspr failed for some reason." << std::endl
<< " exception handled:" << std::endl
<< " type = <unknown>" << std::endl
;
return EXIT_FAILURE;
}
std::cout << " testspr succeeded." << std::endl;
}
#endif