relocate the addtoken leak "test" to umlaut.test.c

This commit is contained in:
Enno Rehling 2016-09-05 18:46:02 +02:00
parent 7b5383dfff
commit fa6a3e377d
3 changed files with 11 additions and 19 deletions

View File

@ -17,7 +17,6 @@ IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /WX /MP")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG

View File

@ -19,21 +19,6 @@ static void test_init_directions(CuTest *tc) {
test_cleanup();
}
static void test_leak(CuTest *tc) {
struct locale *lang;
void **tokens;
variant token;
test_setup();
lang = get_or_create_locale("de");
tokens = get_translations(lang, UT_DIRECTIONS);
token.i = D_NORTHWEST;
addtoken(tokens, "NW", token);
addtoken(tokens, "northwest", token);
test_cleanup();
}
static void test_init_direction(CuTest *tc) {
struct locale *lang;
test_setup();
@ -68,12 +53,9 @@ static void test_finddirection(CuTest *tc) {
CuSuite *get_direction_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_leak);
/*
SUITE_ADD_TEST(suite, test_init_direction);
SUITE_ADD_TEST(suite, test_init_directions);
SUITE_ADD_TEST(suite, test_finddirection);
*/
return suite;
}

View File

@ -97,6 +97,16 @@ static void test_umlaut(CuTest * tc)
freetokens(tokens);
}
static void test_leak(CuTest *tc) {
void *tokens = NULL;
variant token;
token.i = 42;
addtoken(&tokens, "NW", token);
addtoken(&tokens, "northwest", token);
freetokens(tokens);
}
CuSuite *get_umlaut_suite(void)
{
CuSuite *suite = CuSuiteNew();
@ -104,5 +114,6 @@ CuSuite *get_umlaut_suite(void)
SUITE_ADD_TEST(suite, test_directions);
SUITE_ADD_TEST(suite, test_transliterate);
SUITE_ADD_TEST(suite, test_transliterations);
SUITE_ADD_TEST(suite, test_leak);
return suite;
}