Browse Source

fix tests after moving pybind code

python
Jørgen Lien Sellæg 7 years ago committed by Jørgen Sverre Lien Sellæg
parent
commit
0f4c4a7ce7
  1. 3
      CMakeLists.txt
  2. 2
      src/juci.hpp
  3. 54
      tests/CMakeLists.txt
  4. 7
      tests/python_interpreter_test.cc
  5. 5
      tests/stubs/config.cc
  6. 2
      tests/stubs/config.cpp

3
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})

2
src/juci.hpp

@ -43,7 +43,5 @@ private:
std::vector<std::pair<boost::filesystem::path, size_t>> files;
std::vector<std::string> errors;
Window window;
#ifdef JUCI_ENABLE_PLUGINS
Plugins plugins;
#endif
};

54
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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_OBJECTS:test_stubs>)
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 $<TARGET_OBJECTS:test_stubs>)

7
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<Gtk::Application> 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<py::list>().append(test_file_path.string());
config.terminal.history_size = 100;
}

5
tests/stubs/config.cc

@ -0,0 +1,5 @@
#include "config.h"
Config::Config() {}
void Config::load() {}
void Config::init_module(py::module &) {}

2
tests/stubs/config.cpp

@ -1,3 +1,5 @@
#include "config.hpp"
Config::Config() {}
void Config::load() {}
void Config::init_module(py::module &) {}

Loading…
Cancel
Save