From 51de983d8f5c70488ea7bb9363e8f398899cebb9 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 22 May 2016 18:06:22 +0200 Subject: [PATCH 1/3] Fixed cmake_test in case jucipp folder is not named jucipp --- tests/cmake_test.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/cmake_test.cc b/tests/cmake_test.cc index 2276bde..7dd8e35 100644 --- a/tests/cmake_test.cc +++ b/tests/cmake_test.cc @@ -4,9 +4,11 @@ #include int main() { - CMake cmake(JUCI_TESTS_PATH); + auto tests_path=boost::filesystem::canonical(JUCI_TESTS_PATH); - g_assert(cmake.project_path.filename()=="jucipp"); + CMake cmake(tests_path); + + g_assert(cmake.project_path==boost::filesystem::canonical(tests_path/"..")); auto functions_parameters=cmake.get_functions_parameters("project"); g_assert(functions_parameters.at(0).second.at(0)=="juci"); From cca68fc5730b4d9266aef9f6e0c3eabdc064526a Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 22 May 2016 18:36:20 +0200 Subject: [PATCH 2/3] Cleanup of cmake_test --- tests/cmake_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cmake_test.cc b/tests/cmake_test.cc index 7dd8e35..48a0968 100644 --- a/tests/cmake_test.cc +++ b/tests/cmake_test.cc @@ -13,8 +13,8 @@ int main() { auto functions_parameters=cmake.get_functions_parameters("project"); g_assert(functions_parameters.at(0).second.at(0)=="juci"); - g_assert(cmake.get_executable(boost::filesystem::path(JUCI_TESTS_PATH)/"cmake_test.cc").filename()=="cmake_test"); + g_assert(cmake.get_executable(tests_path/"cmake_test.cc").filename()=="cmake_test"); - auto build=Project::Build::create(JUCI_TESTS_PATH); + auto build=Project::Build::create(tests_path); g_assert(dynamic_cast(build.get())); } From ac18d661abd8b2dd9f30e7b242b0a675b90391f3 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 22 May 2016 20:43:15 +0200 Subject: [PATCH 3/3] Added extra cmake tests --- tests/cmake_test.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/cmake_test.cc b/tests/cmake_test.cc index 48a0968..b6786b5 100644 --- a/tests/cmake_test.cc +++ b/tests/cmake_test.cc @@ -1,14 +1,16 @@ #include #include "cmake.h" #include "project_build.h" +#include "config.h" #include int main() { auto tests_path=boost::filesystem::canonical(JUCI_TESTS_PATH); + auto project_path=boost::filesystem::canonical(tests_path/".."); CMake cmake(tests_path); - g_assert(cmake.project_path==boost::filesystem::canonical(tests_path/"..")); + g_assert(cmake.project_path==project_path); auto functions_parameters=cmake.get_functions_parameters("project"); g_assert(functions_parameters.at(0).second.at(0)=="juci"); @@ -17,4 +19,21 @@ int main() { auto build=Project::Build::create(tests_path); g_assert(dynamic_cast(build.get())); + + build=Project::Build::create(tests_path/"stubs"); + g_assert(dynamic_cast(build.get())); + g_assert(build->project_path==project_path); + + Config::get().project.default_build_path="./build"; + g_assert(build->get_default_path()==project_path/"./build"); + + Config::get().project.debug_build_path="/debug"; + g_assert(build->get_debug_path()==project_path/"./build/debug"); + + auto project_path_filename=project_path.filename(); + Config::get().project.debug_build_path="../debug_"; + g_assert(build->get_debug_path()==project_path/("../debug_"+project_path_filename.string())); + + Config::get().project.default_build_path="../build_"; + g_assert(build->get_default_path()==project_path/("../build_"+project_path_filename.string())); }