mirror of https://gitlab.com/cppit/jucipp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.8 KiB
47 lines
1.8 KiB
|
6 years ago
|
#include "compile_commands.hpp"
|
||
|
9 years ago
|
#include <glib.h>
|
||
|
6 years ago
|
#include <gtkmm.h>
|
||
|
6 years ago
|
#include <gtksourceviewmm.h>
|
||
|
9 years ago
|
|
||
|
|
int main() {
|
||
|
6 years ago
|
auto app = Gtk::Application::create();
|
||
|
6 years ago
|
Gsv::init();
|
||
|
6 years ago
|
|
||
|
8 years ago
|
auto tests_path = boost::filesystem::canonical(JUCI_TESTS_PATH);
|
||
|
|
|
||
|
6 years ago
|
{
|
||
|
|
CompileCommands::FindSystemIncludePaths system_include_paths;
|
||
|
|
g_assert(system_include_paths);
|
||
|
|
g_assert(!system_include_paths.include_paths.empty());
|
||
|
|
}
|
||
|
9 years ago
|
{
|
||
|
8 years ago
|
CompileCommands compile_commands(tests_path / "meson_test_files" / "build");
|
||
|
|
|
||
|
|
g_assert(compile_commands.commands.at(0).directory == "jucipp/tests/meson_test_files/build");
|
||
|
|
|
||
|
9 years ago
|
g_assert_cmpuint(compile_commands.commands.size(), ==, 5);
|
||
|
8 years ago
|
|
||
|
9 years ago
|
g_assert_cmpstr(compile_commands.commands.at(4).parameters.at(0).c_str(), ==, "te's\"t");
|
||
|
|
g_assert_cmpstr(compile_commands.commands.at(4).parameters.at(1).c_str(), ==, "te st");
|
||
|
|
g_assert_cmpstr(compile_commands.commands.at(4).parameters.at(2).c_str(), ==, "test");
|
||
|
|
g_assert_cmpstr(compile_commands.commands.at(4).parameters.at(3).c_str(), ==, "te\\st");
|
||
|
|
g_assert_cmpstr(compile_commands.commands.at(4).parameters.at(4).c_str(), ==, "te\\\\st");
|
||
|
8 years ago
|
|
||
|
|
auto parameter_values = compile_commands.commands.at(0).parameter_values("-o");
|
||
|
9 years ago
|
g_assert_cmpuint(parameter_values.size(), ==, 1);
|
||
|
|
g_assert_cmpstr(parameter_values.at(0).c_str(), ==, "hello_lib@sta/main.cpp.o");
|
||
|
8 years ago
|
|
||
|
|
g_assert(boost::filesystem::canonical(compile_commands.commands.at(0).file) == tests_path / "meson_test_files" / "main.cpp");
|
||
|
9 years ago
|
}
|
||
|
8 years ago
|
|
||
|
9 years ago
|
{
|
||
|
8 years ago
|
CompileCommands compile_commands(tests_path / "source_clang_test_files" / "build");
|
||
|
|
|
||
|
|
g_assert(compile_commands.commands.at(0).directory == ".");
|
||
|
|
|
||
|
9 years ago
|
g_assert_cmpuint(compile_commands.commands.size(), ==, 1);
|
||
|
8 years ago
|
|
||
|
9 years ago
|
g_assert_cmpstr(compile_commands.commands.at(0).parameters.at(2).c_str(), ==, "-Wall");
|
||
|
|
}
|
||
|
|
}
|