Made unit tests work again

This commit is contained in:
Yevgen Muntyan 2010-07-13 04:52:45 -07:00
parent fcfe1cf30e
commit 4476a11c79
6 changed files with 32 additions and 16 deletions

View File

@ -14,10 +14,14 @@ SET(MOO_PACKAGE_VENDOR ${MOO_EMAIL})
MOO_OPTION(MOO_BUILD_CTAGS ${MOO_OS_UNIX} "Build Ctags plugin" HIDDEN ${MOO_OS_WIN32} HEADER TRUE) MOO_OPTION(MOO_BUILD_CTAGS ${MOO_OS_UNIX} "Build Ctags plugin" HIDDEN ${MOO_OS_WIN32} HEADER TRUE)
MOO_OPTION(MOO_ENABLE_PROJECT FALSE "Build project plugin" HIDDEN TRUE) MOO_OPTION(MOO_ENABLE_PROJECT FALSE "Build project plugin" HIDDEN TRUE)
MOO_OPTION(MOO_ENABLE_UNIT_TESTS FALSE "Build unit tests" DEFINE TRUE)
MOO_OPTION(MOO_ENABLE_GENERATED_FILES ${MOO_OS_UNIX} "Run gtk-update-icon-cache on install") MOO_OPTION(MOO_ENABLE_GENERATED_FILES ${MOO_OS_UNIX} "Run gtk-update-icon-cache on install")
MOO_OPTION(MOO_BROKEN_GTK_THEME FALSE "Work around bugs in gtk theme" HEADER TRUE) MOO_OPTION(MOO_BROKEN_GTK_THEME FALSE "Work around bugs in gtk theme" HEADER TRUE)
MOO_OPTION(MOO_ENABLE_UNIT_TESTS FALSE "Build unit tests" DEFINE TRUE)
IF(MOO_ENABLE_UNIT_TESTS)
ADD_DEFINITIONS(-DMOO_ENABLE_UNIT_TESTS)
ENDIF(MOO_ENABLE_UNIT_TESTS)
INCLUDE(cmake/gtk.cmake) INCLUDE(cmake/gtk.cmake)
INCLUDE(cmake/moo.cmake) INCLUDE(cmake/moo.cmake)
INCLUDE(cmake/dist.cmake) INCLUDE(cmake/dist.cmake)
@ -56,6 +60,10 @@ IF(WIN32)
CONFIGURE_FILE(plat/win32/run-medit.in run-medit.bat) CONFIGURE_FILE(plat/win32/run-medit.in run-medit.bat)
SET(_MOO_RUN_HOW "gdb --args ") SET(_MOO_RUN_HOW "gdb --args ")
CONFIGURE_FILE(plat/win32/run-medit.in run-medit-in-gdb.bat) CONFIGURE_FILE(plat/win32/run-medit.in run-medit-in-gdb.bat)
IF(MOO_ENABLE_UNIT_TESTS)
SET(_MOO_RUN_HOW "@")
CONFIGURE_FILE(plat/win32/run-tests.in run-tests.bat)
ENDIF(MOO_ENABLE_UNIT_TESTS)
ENDIF(WIN32) ENDIF(WIN32)
IF(NOT WIN32) IF(NOT WIN32)

View File

@ -2,9 +2,9 @@ IF(MOO_ENABLE_PROJECT)
ADD_DEFINITIONS(-DMOO_ENABLE_PROJECT) ADD_DEFINITIONS(-DMOO_ENABLE_PROJECT)
ENDIF(MOO_ENABLE_PROJECT) ENDIF(MOO_ENABLE_PROJECT)
IF(MOO_ENABLE_UNIT_TESTS AND NOT WIN32) IF(MOO_ENABLE_UNIT_TESTS)
ADD_DEFINITIONS(-DSRCDIR="${CMAKE_SOURCE_DIR}/medit") ADD_DEFINITIONS(-DSRCDIR="${CMAKE_SOURCE_DIR}/medit")
ENDIF(MOO_ENABLE_UNIT_TESTS AND NOT WIN32) ENDIF(MOO_ENABLE_UNIT_TESTS)
IF(MOO_ENABLE_PYTHON) IF(MOO_ENABLE_PYTHON)
SET(moopythonlib moopython) SET(moopythonlib moopython)
@ -34,7 +34,11 @@ IF(MOO_OS_LINUX)
LIST(APPEND MOO_DEP_LIBS m dl) LIST(APPEND MOO_DEP_LIBS m dl)
ENDIF(MOO_OS_LINUX) ENDIF(MOO_OS_LINUX)
ADD_EXECUTABLE(medit WIN32 ${MEDIT_SOURCES}) IF(NOT MOO_ENABLE_UNIT_TESTS)
SET(MEDIT_WIN32 WIN32)
ENDIF(NOT MOO_ENABLE_UNIT_TESTS)
ADD_EXECUTABLE(medit ${MEDIT_WIN32} ${MEDIT_SOURCES})
TARGET_LINK_LIBRARIES(medit ${medit_libs} ${MOO_DEP_LIBS}) TARGET_LINK_LIBRARIES(medit ${medit_libs} ${MOO_DEP_LIBS})
INSTALL(TARGETS medit DESTINATION ${BINDIR}) INSTALL(TARGETS medit DESTINATION ${BINDIR})
@ -45,8 +49,10 @@ ENDIF(MOO_ENABLE_PYTHON)
FIND_PACKAGE(MooDesktopFile) FIND_PACKAGE(MooDesktopFile)
MOO_INSTALL_DESKTOP_FILE(medit.desktop.in) MOO_INSTALL_DESKTOP_FILE(medit.desktop.in)
SET(PIXMAPS_DIR "${DATADIR}/pixmaps") IF(MOO_OS_UNIX)
SET(ICONTHEME_DIR "${DATADIR}/icons/hicolor/48x48/apps") SET(PIXMAPS_DIR "${DATADIR}/pixmaps")
SET(MEDIT_ICONS "${CMAKE_SOURCE_DIR}/moo/mooutils/pixmaps/medit.png") SET(ICONTHEME_DIR "${DATADIR}/icons/hicolor/48x48/apps")
INSTALL(FILES ${MEDIT_ICONS} DESTINATION "${PIXMAPS_DIR}") SET(MEDIT_ICONS "${CMAKE_SOURCE_DIR}/moo/mooutils/pixmaps/medit.png")
INSTALL(FILES ${MEDIT_ICONS} DESTINATION "${ICONTHEME_DIR}") INSTALL(FILES ${MEDIT_ICONS} DESTINATION "${PIXMAPS_DIR}")
INSTALL(FILES ${MEDIT_ICONS} DESTINATION "${ICONTHEME_DIR}")
ENDIF(MOO_OS_UNIX)

View File

@ -46,11 +46,7 @@ unit_tests_main (int argc, char *argv[])
g_thread_init (NULL); g_thread_init (NULL);
g_set_prgname ("run-tests"); g_set_prgname ("run-tests");
#ifdef __WIN32__
data_dir = "test-data";
#else
data_dir = SRCDIR "/data"; data_dir = SRCDIR "/data";
#endif
grp = g_option_group_new ("run-tests", "run-tests", "run-tests", NULL, NULL); grp = g_option_group_new ("run-tests", "run-tests", "run-tests", NULL, NULL);
g_option_group_add_entries (grp, options); g_option_group_add_entries (grp, options);
@ -83,7 +79,7 @@ unit_tests_main (int argc, char *argv[])
moo_test_cleanup (); moo_test_cleanup ();
#ifdef __WIN32__ #ifdef __WIN32__
if (!g_getenv ("WINESERVER")) if (!g_getenv ("WINESERVER") && !list_only)
{ {
printf ("Done, press Enter..."); printf ("Done, press Enter...");
fflush (stdout); fflush (stdout);

View File

@ -2072,7 +2072,10 @@ test_encodings_1 (const char *name,
editor = moo_editor_instance (); editor = moo_editor_instance ();
doc = moo_editor_open_file (editor, NULL, NULL, filename, encoding); doc = moo_editor_open_file (editor, NULL, NULL, filename, encoding);
TEST_ASSERT (doc != NULL); TEST_ASSERT_MSG (doc != NULL,
"file '%s', encoding '%s'",
TEST_FMT_STR (filename),
TEST_FMT_STR (encoding));
if (doc) if (doc)
{ {

View File

@ -1,3 +1,3 @@
@pushd ${_MOO_BINARY_DIR}\moo @pushd ${_MOO_BINARY_DIR}\moo
${_MOO_RUN_HOW}${_MOO_BINARY_DIR}\medit\medit.exe -n --log-window %1 %2 %3 %4 %5 %6 %7 %8 %9 ${_MOO_RUN_HOW}${_MOO_BINARY_DIR}\medit\medit.exe -n --log-window %*
@popd @popd

3
plat/win32/run-tests.in Normal file
View File

@ -0,0 +1,3 @@
@pushd ${_MOO_BINARY_DIR}
${_MOO_RUN_HOW}${_MOO_BINARY_DIR}\medit\medit.exe --ut %*
@popd