Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ enable_testing()
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.53 COMPONENTS unit_test_framework)
find_package(Boost 1.53 COMPONENTS unit_test_framework REQUIRED)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DBOOST_SPIRIT_USE_PHOENIX_V3=1")

macro(add_boost_test name source)
add_executable(${name} ${source})
target_include_directories(${name} PRIVATE ${Boost_INCLUDE_DIRS})
target_link_libraries(${name} boost_boostache ${Boost_LIBRARIES})
add_test(${name} ${name})
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)

add_executable(${name} ${source})

target_include_directories(${name} PRIVATE ${Boost_INCLUDE_DIRS})
target_link_libraries(${name} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_LIBRARIES})

add_test(NAME ${name} COMMAND ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endmacro(add_boost_test)

add_subdirectory(boost)
add_subdirectory(test)
add_subdirectory(examples)
add_subdirectory(test)
12 changes: 11 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
add_subdirectory(company_report)
include_directories(${CMAKE_SOURCE_DIR}/include)

add_executable(example1 example1.cpp)
add_executable(example2 example2.cpp)
add_executable(example3 example3.cpp)
add_executable(simple_generate2 simple_generate2.cpp)

# TODO: This was still in the CMakeLists.txt, but not the Jamfile...
# is it obsolete?
# add_subdirectory(company_report)


10 changes: 8 additions & 2 deletions examples/company_report/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 2.8)

include_directories(${CMAKE_SOURCE_DIR}/include)
add_executable(company_report_stache company_report_stache.cpp)
target_link_libraries(company_report_stache boost_boostache)

add_executable(example1 example1.cpp)
target_link_libraries(example1 boost_boostache)

add_executable(example2 example2.cpp)
target_link_libraries(example2 boost_boostache)

add_executable(example3 example3.cpp)
target_link_libraries(example3 boost_boostache)
2 changes: 1 addition & 1 deletion examples/example2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main()
// Apply the compiled template and the data model to the generate
// method
std::stringstream stream;
bstache::generate(stream, templ, invoice);
boostache::generate(stream, templ, invoice);
// ------------------------------------------------------------------

std::cout << stream.str();
Expand Down
19 changes: 4 additions & 15 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
cmake_minimum_required(VERSION 2.8)

add_subdirectory(frontend)
add_subdirectory(model)
add_subdirectory(mustache)
add_subdirectory(vm)

include_directories(${CMAKE_SOURCE_DIR}/include)
add_boost_test(test_simple_parser test_simple_parser.cpp)
add_boost_test(test_model test_model.cpp)
add_boost_test(test_dynamic_model test_dynamic_model.cpp)
add_boost_test(test_json_model test_json_model.cpp)
add_boost_test(test_default_model test_default_model.cpp)
add_boost_test(test_collections test_collections.cpp)
add_boost_test(test_html_escape test_html_escape.cpp)
add_boost_test(test_multiple test_multiple.cpp)
add_boost_test(test_nested_sections test_nested_sections.cpp)
add_boost_test(test_partials test_partials.cpp)
add_boost_test(test_sections test_sections.cpp)
add_boost_test(test_change_delimiter test_change_delimiter.cpp)
add_boost_test(test_inverted_sections test_inverted_sections.cpp)
add_boost_test(test_mustache_demo test_mustache_demo.cpp)
1 change: 0 additions & 1 deletion test/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ include_directories(${CMAKE_SOURCE_DIR}/include)

add_boost_test(adapt_test adapt_test.cpp)
add_boost_test(grammar_basic grammar_basic.cpp)
add_boost_test(compiler_basic compiler_basic.cpp)
11 changes: 11 additions & 0 deletions test/model/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include_directories(${CMAKE_SOURCE_DIR}/include)

add_boost_test( render_traits render_traits.cpp)
# TODO: Does not build, cannot find simple_parser.hpp , which was removed
#
# add_boost_test( test_default_model test_default_model.cpp)
# add_boost_test( test_ptree_model test_ptree_model.cpp)
add_boost_test( traits traits.cpp)

# TODO: Doesn't link, no matching function for call to 'test'
# add_boost_test( unwrap_variant unwrap_variant.cpp)
1 change: 0 additions & 1 deletion test/model/test_default_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN

#include <boost/test/unit_test.hpp>
Expand Down
1 change: 0 additions & 1 deletion test/model/test_ptree_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN

#include <boost/test/unit_test.hpp>
Expand Down
6 changes: 6 additions & 0 deletions test/mustache/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include_directories(${CMAKE_SOURCE_DIR}/include)

add_boost_test(mustache_compiler mustache_compiler.cpp)
add_boost_test(mustache_end2end mustache_end2end.cpp)
add_boost_test(mustache_parser mustache_parser.cpp)

4 changes: 3 additions & 1 deletion test/mustache/mustache_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/test/unit_test.hpp>
#include <boost/boostache/stache.hpp>
#include <boost/boostache/frontend/stache/grammar_def.hpp>
#include <boost/boostache/frontend/parse.hpp>
Expand All @@ -20,6 +19,9 @@
#include <sstream>
#include <fstream>

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

namespace boostache = boost::boostache;
namespace fe = boost::boostache::frontend;

Expand Down
4 changes: 3 additions & 1 deletion test/mustache/mustache_end2end.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/test/unit_test.hpp>
#include <boost/spirit/include/support_extended_variant.hpp>

#include <boost/boostache/boostache.hpp>
Expand All @@ -21,6 +20,9 @@
#include <map>
#include <vector>

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

namespace boostache = boost::boostache;
namespace fe = boost::boostache::frontend;

Expand Down
4 changes: 3 additions & 1 deletion test/mustache/mustache_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#include <boost/test/unit_test.hpp>
#include <boost/boostache/stache.hpp>
#include <boost/boostache/frontend/stache/grammar_def.hpp>
#include <boost/boostache/frontend/stache/ast.hpp>
Expand All @@ -19,6 +18,9 @@
#include <sstream>
#include <fstream>

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>

namespace bstache = boost::boostache;
namespace fe = boost::boostache::frontend;

Expand Down
1 change: 0 additions & 1 deletion test/shared/parser_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_NO_MAIN

#include <boost/filesystem.hpp>
Expand Down
4 changes: 4 additions & 0 deletions test/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR}/include)

add_boost_test(foreach foreach.cpp)