From 0f4c4a7ce7bcd6ad8c796ae0cc73c10dfd06e9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Sat, 20 Apr 2019 13:44:59 +0200 Subject: [PATCH] fix tests after moving pybind code --- CMakeLists.txt | 3 -- src/juci.hpp | 2 -- tests/CMakeLists.txt | 54 +++++++++++++++++++++++++++++++- tests/python_interpreter_test.cc | 7 ++--- tests/stubs/config.cc | 5 +++ tests/stubs/config.cpp | 2 ++ 6 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 tests/stubs/config.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index f133543..356cba2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,10 +97,7 @@ if(${PYTHONLIBS_FOUND}) endif() if(${PYGOBJECT_FOUND}) - add_definitions(-DJUCI_ENABLE_PLUGINS) add_definitions(-DPYTHON_HOME_DIR=L"${PYTHON_LIBRARY_DIR}") -else() - message(STATUS "Python or pygobject not found. Building juCi++ without plugin support.") endif() set(BUILD_TESTING_SAVED ${BUILD_TESTING}) diff --git a/src/juci.hpp b/src/juci.hpp index 45b36c1..279ca8a 100644 --- a/src/juci.hpp +++ b/src/juci.hpp @@ -43,7 +43,5 @@ private: std::vector> files; std::vector errors; Window window; -#ifdef JUCI_ENABLE_PLUGINS Plugins plugins; -#endif }; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2999a72..44ac878 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,6 +21,7 @@ add_library(test_stubs OBJECT stubs/selection_dialog.cpp ) +<<<<<<< HEAD if(BUILD_TESTING) add_executable(process_test process_test.cpp $) target_link_libraries(process_test juci_shared) @@ -120,10 +121,61 @@ if(BUILD_FUZZING) target_compile_options(markdown_fuzzer PRIVATE -fsanitize=address,fuzzer) target_link_options(markdown_fuzzer PRIVATE -fsanitize=address,fuzzer) target_link_libraries(markdown_fuzzer juci_shared) +======= +add_executable(process_test process_test.cc $) +target_link_libraries(process_test juci_shared ${PYTHON_LIBRARIES}) +add_test(process_test process_test) + +add_executable(compile_commands_test compile_commands_test.cc $) + target_link_libraries(compile_commands_test juci_shared ${PYTHON_LIBRARIES}) +add_test(compile_commands_test compile_commands_test) + +add_executable(filesystem_test filesystem_test.cc $) +target_link_libraries(filesystem_test juci_shared ${PYTHON_LIBRARIES}) +add_test(filesystem_test filesystem_test) + +add_executable(cmake_build_test cmake_build_test.cc $) +target_link_libraries(cmake_build_test juci_shared ${PYTHON_LIBRARIES}) +add_test(cmake_build_test cmake_build_test) + +add_executable(meson_build_test meson_build_test.cc $) +target_link_libraries(meson_build_test juci_shared ${PYTHON_LIBRARIES}) +add_test(meson_build_test meson_build_test) + +add_executable(source_test source_test.cc $) +target_link_libraries(source_test juci_shared ${PYTHON_LIBRARIES}) +add_test(source_test source_test) + +add_executable(source_clang_test source_clang_test.cc $) +target_link_libraries(source_clang_test juci_shared ${PYTHON_LIBRARIES}) +add_test(source_clang_test source_clang_test) + +add_executable(source_generic_test source_generic_test.cc $) +target_link_libraries(source_generic_test juci_shared ${PYTHON_LIBRARIES}) +add_test(source_generic_test source_generic_test) + +add_executable(source_key_test source_key_test.cc $) +target_link_libraries(source_key_test juci_shared ${PYTHON_LIBRARIES}) +add_test(source_key_test source_key_test) + +add_executable(terminal_test terminal_test.cc $) +target_link_libraries(terminal_test juci_shared ${PYTHON_LIBRARIES}) +add_test(terminal_test terminal_test) + +add_executable(usages_clang_test usages_clang_test.cc $) +target_link_libraries(usages_clang_test juci_shared ${PYTHON_LIBRARIES}) +add_test(usages_clang_test usages_clang_test) + +if(LIBLLDB_FOUND) + add_executable(lldb_test lldb_test.cc $) + target_link_libraries(lldb_test juci_shared ${PYTHON_LIBRARIES}) + add_test(lldb_test lldb_test) + add_subdirectory("lldb_test_files") +>>>>>>> de6858a... fix tests after moving pybind code endif() add_executable(git_test git_test.cc $) -target_link_libraries(git_test juci_shared) +target_link_libraries(git_test juci_shared ${PYTHON_LIBRARIES}) add_test(git_test git_test) add_executable(python_interpreter_test python_interpreter_test.cc $) diff --git a/tests/python_interpreter_test.cc b/tests/python_interpreter_test.cc index 3773e29..0fdabaa 100644 --- a/tests/python_interpreter_test.cc +++ b/tests/python_interpreter_test.cc @@ -1,24 +1,21 @@ #include "config.h" #include "plugins.h" #include "python_interpreter.h" -#include "python_module.h" #include "terminal.h" #include "config.h" -#include "python_module.h" class __attribute__((visibility("default"))) suite { public: Glib::RefPtr app = Gtk::Application::create(); - py::detail::embedded_module jucipp = py::detail::embedded_module("Jucipp", Module::init_jucipp_module); - Python::Interpreter interpreter; + Plugins plugins; Terminal &terminal = Terminal::get(); Config &config = Config::get(); boost::filesystem::path test_file_path = boost::filesystem::canonical(std::string(JUCI_TESTS_PATH) + "/python_interpreter_test_files"); bool has_assertion = false; suite() { - auto sys = interpreter.add_module("sys"); + auto sys = plugins.interpreter.add_module("sys"); sys.attr("path").cast().append(test_file_path.string()); config.terminal.history_size = 100; } diff --git a/tests/stubs/config.cc b/tests/stubs/config.cc new file mode 100644 index 0000000..2d75322 --- /dev/null +++ b/tests/stubs/config.cc @@ -0,0 +1,5 @@ +#include "config.h" + +Config::Config() {} +void Config::load() {} +void Config::init_module(py::module &) {} diff --git a/tests/stubs/config.cpp b/tests/stubs/config.cpp index 0445e5d..e798955 100644 --- a/tests/stubs/config.cpp +++ b/tests/stubs/config.cpp @@ -1,3 +1,5 @@ #include "config.hpp" Config::Config() {} +void Config::load() {} +void Config::init_module(py::module &) {}