diff --git a/tests/main.cpp b/tests/main.cpp index 18c03253fa1c1c0c6190f3e1d9a09f352d3a8d88..0cbc1e4064ed5aedfa613b73afebc702bc11bee5 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,5 +1,6 @@ //#define BOOST_TEST_MODULE master #include <boost/test/included/unit_test.hpp> +#include <unicode/uclean.h> BOOST_AUTO_TEST_CASE(test_test) { @@ -7,6 +8,20 @@ BOOST_AUTO_TEST_CASE(test_test) BOOST_CHECK(a == 0); } +//Auto cleanup of ICU with a static variable destructor. +//ICU can hold onto some memory resources until program exit, +//when the system is reclaiming them as usual. This is not a memory +//leak but makes tools like valgrind all excited that +//there is memory which is "still reachable but not freed." +//So, the below will perform icu cleanup before test program exit. +static struct ICU_cleaner +{ + ~ICU_cleaner() + { + u_cleanup(); + } +} the_cleaner; + boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) { return 0;