diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..412c8525 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.* +cmake-build* +*~ +a.out +*.o diff --git a/.travis.yml b/.travis.yml index 9c775802..074dfa71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,69 +1,154 @@ language: cpp -#dist: trusty +sudo: required +dist: trusty matrix: include: + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.7 + - ppa:george-edison55/cmake-3.x + packages: + - g++-6 + - clang-3.7 + - llvm-3.7-runtime + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + env: + - COMPILER="clang++-3.7" + before_script: + # The clang runtime for the address sanitizer is missing from the + # apt, hence the downloaded tarballs. + + - wget http://llvm.org/releases/3.7.1/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - tar -xvf clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - sudo cp -n clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04/lib/clang/3.7.1/lib/linux/*.a /usr/lib/llvm-3.7/lib/clang/3.7.1/lib/linux/ + - CXX=${COMPILER} ./check_errors.sh + - mkdir build && cd build + - CXX=${COMPILER} cmake -DCMAKE_BUILD_TYPE=Debug -DTRAVIS_JOB_ID='${TRAVIS_JOB_ID}' -DSANITIZE=true .. + - make VERBOSE=1 self_test kcov - os: linux - compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-4.9', 'libcurl4-openssl-dev', 'libelf-dev', 'libdw-dev', 'cmake', 'gdb'] + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-3.8 + packages: + - g++-6 + - clang-3.8 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - - COMPILER=g++-4.9 - - WARNINGS="-Wall -Wextra -pedantic" - - SANITIZERS="-fsanitize=address,undefined" + - COMPILER="clang++-3.8" - os: linux - compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-5', 'libcurl4-openssl-dev', 'libelf-dev', 'libdw-dev', 'cmake', 'gdb'] + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.9 + packages: + - g++-6 + - clang-3.9 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - - COMPILER=g++-5 - - WARNINGS="-Wall -Wextra -pedantic" - - SANITIZERS="-fsanitize=undefined" + - COMPILER="clang++-3.9" + before_script: + # Unlike with clang++-3.7, the runtime libraries exists with 3.9, + # but still doesn't work because of gold linker version incompatibility. + # The tarball download takes care of that. + + - wget http://llvm.org/releases/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - tar -xvf clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - sudo cp clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-14.04/lib/clang/3.9.1/lib/linux/*.a /usr/lib/llvm-3.9/lib/clang/3.9.1/lib/linux/ + - CXX=${COMPILER} ./check_errors.sh + - mkdir build && cd build + - CXX=${COMPILER} cmake -DCMAKE_BUILD_TYPE=Debug -DTRAVIS_JOB_ID='${TRAVIS_JOB_ID}' -DSANITIZE=true .. + - make VERBOSE=1 self_test kcov - os: linux - compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'libcurl4-openssl-dev', 'libelf-dev', 'libdw-dev', 'cmake', 'gdb'] + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-4.0 + packages: + - g++-6 + - clang-4.0 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - - COMPILER=g++-6 - - WARNINGS="-Wall -Wextra -pedantic -Wmisleading-indentation" - - SANITIZERS="-fsanitize=undefined" + - COMPILER="clang++-4.0" - os: linux - compiler: clang addons: apt: - sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test'] - packages: ['clang-3.7', 'libcurl4-openssl-dev', 'libelf-dev', 'libdw-dev', 'cmake', 'gdb'] + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - - COMPILER=clang++-3.7 - - WARNINGS="-Weverything -Wno-c++98-compat-pedantic -Wno-padded -Wno-weak-vtables -Wno-exit-time-destructors" + - COMPILER="g++-4.9" - os: linux - compiler: clang addons: apt: - sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test'] - packages: ['clang-3.8', 'libcurl4-openssl-dev', 'libelf-dev', 'libdw-dev', 'cmake', 'gdb'] + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev env: - - COMPILER=clang++-3.8 - - WARNINGS="-Weverything -Wno-c++98-compat-pedantic -Wno-padded -Wno-weak-vtables -Wno-exit-time-destructors" - - SANITIZERS="-fsanitize=undefined,address" + - COMPILER="g++-5" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + env: + - COMPILER="g++-6" + + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + env: + - COMPILER="g++-7" before_script: - CXX=$COMPILER ./check_errors.sh + - CXX=${COMPILER} ./check_errors.sh + - mkdir build && cd build + - CXX=${COMPILER} cmake -DCMAKE_BUILD_TYPE=Debug -DTRAVIS_JOB_ID='${TRAVIS_JOB_ID}' -DSANITIZE=true .. + - make VERBOSE=1 self_test kcov script: - wget https://github.com/philsquared/Catch/archive/V1.5.0.tar.gz && tar xfz V1.5.0.tar.gz && make CXX=$COMPILER CXXFLAGS="${WARNINGS} ${SANITIZERS} ${CXXFLAGS} -std=c++14 -I Catch-1.5.0/include -g ${CPPFLAGS}" -f Makefile.travis + make run_self_test after_success: - make clean -f Makefile.travis && make CXX=$COMPILER CXXFLAGS="-std=c++14 ${STDLIB} -I Catch-1.5.0/include -g" -f Makefile.travis && wget https://github.com/SimonKagstrom/kcov/archive/master.zip && unzip master.zip && mv kcov-master kcov && mkdir kcov/build && cd kcov/build && cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release .. && make && make install DESTDIR=../built && cd ../.. && ./kcov/built/usr/local/bin/kcov --skip-solibs --include-pattern=trompeloeil.hpp --coveralls-id=${TRAVIS_JOB_ID} ./cov ./self_test -s + make VERBOSE=1 run_coverage diff --git a/CMakeLists.txt b/CMakeLists.txt index 387bc21d..b64826e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,37 +1,202 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.0) project(trompeloeil) include(GNUInstallDirs) +include(ExternalProject) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/trompeloeil/trompeloeil-config-version.cmake" + VERSION 27 + COMPATIBILITY AnyNewerVersion) + +set(CMAKE_CXX_STANDARD 14) add_library(trompeloeil INTERFACE) -target_sources(trompeloeil INTERFACE trompeloeil.hpp) +set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories( + trompeloeil + INTERFACE + $ +) -include(GNUInstallDirs) +target_include_directories( + trompeloeil + INTERFACE + $/include> +) + +set(MASTER_PROJECT OFF) +if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) + set(MASTER_PROJECT ON) +endif() + +if (MASTER_PROJECT AND CMAKE_BUILD_TYPE MATCHES Debug) + set(CATCH_DIR ${CMAKE_CURRENT_BINARY_DIR}/catch) + if(NOT EXISTS ${CATCH_DIR}/catch.hpp) + if (NOT EXISTS ${CATCH_DIR}) + make_directory(${CATCH_DIR}) + endif() + file( + DOWNLOAD + https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp ${CATCH_DIR}/catch.hpp + STATUS + status + LOG + log + ) + list(GET status 0 status_code) + list(GET status 1 status_string) + + if(NOT status_code EQUAL 0) + message(FATAL_ERROR "error downloading catch: ${status_string}" + "${log}") + endif() + endif() + + ExternalProject_Add( + kcov + GIT_REPOSITORY + https://github.com/simonkagstrom/kcov + GIT_TAG + v33 + INSTALL_DIR + ${CMAKE_CURRENT_BINARY_DIR}/kcov + CMAKE_ARGS + "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/kcov" + ) + + if (CMAKE_COMPILER_IS_GNUCXX) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(WARN_FLAGS "-Weverything -Wno-c++98-compat-pedantic -Wno-padded -Wno-weak-vtables -Wno-exit-time-destructors") + else() + set(WARN_FLAGS "-Wall -Wextra -pedantic -Wshadow") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS} -Werror") + endif() + + set(TSAN "-fsanitize=undefined,thread") + set(SSAN "-fsanitize=address,undefined") -# if someone knows how to do this with header only libs, pls submitt a pull request + add_executable( + self_test + EXCLUDE_FROM_ALL + test/compiling_tests.cpp + ) -#target_include_directories(trompeloeil INTERFACE -# $ -# $ # /include -#) + target_include_directories( + self_test + PRIVATE + ${CATCH_DIR} + ) -#install(EXPORT trompeloeilConfig DESTINATION share/trompeloeil/cmake) + if (SANITIZE) + set_target_properties( + self_test + PROPERTIES + LINK_FLAGS + "${SSAN} -fuse-ld=gold" + COMPILE_FLAGS + ${SSAN} + ) + endif() -#export(TARGETS trompeloeil FILE trompeloeilConfig.cmake) + target_link_libraries( + self_test + PUBLIC + trompeloeil + ) + add_executable( + thread_terror + EXCLUDE_FROM_ALL + test/thread_terror.cpp + ) -install(FILES trompeloeil.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + target_link_libraries( + thread_terror + PUBLIC + trompeloeil + pthread + ) + + if (SANITIZE) + set_target_properties( + thread_terror + PROPERTIES + LINK_FLAGS + ${TSAN} + COMPILE_FLAGS + ${TSAN} + ) + endif() + + add_custom_target( + run_self_test + COMMAND + ${CMAKE_CURRENT_BINARY_DIR}/self_test + DEPENDS + self_test + ) + + if(TRAVIS_JOB_ID) + set(COVERALLS_FLAG "--coveralls-id=${TRAVIS_JOB_ID}") + endif() + + add_custom_target( + run_coverage + COMMAND + ${CMAKE_CURRENT_BINARY_DIR}/kcov/bin/kcov --skip-solibs --include-pattern=trompeloeil.hpp ${COVERALLS_FLAG} ./coverage ${CMAKE_CURRENT_BINARY_DIR}/self_test + DEPENDS + self_test + kcov + ) +endif() + +install( + TARGETS + trompeloeil + EXPORT + trompeloeil-targets + INCLUDES DESTINATION + include ) -install(FILES LICENSE_1_0.txt - DESTINATION ${CMAKE_INSTALL_DOCDIR} +install( + EXPORT + trompeloeil-targets + DESTINATION + lib/cmake/trompeloeil +) +install( + FILES + trompeloeil-config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/trompeloeil/trompeloeil-config-version.cmake" + DESTINATION + lib/cmake/trompeloeil + COMPONENT + Devel +) + +install( + FILES + include/trompeloeil.hpp + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR} ) -install (DIRECTORY docs - DESTINATION ${CMAKE_INSTALL_DOCDIR} +install( + FILES + LICENSE_1_0.txt + DESTINATION + ${CMAKE_INSTALL_DOCDIR} ) +install( + DIRECTORY + docs + DESTINATION + ${CMAKE_INSTALL_DOCDIR} +) diff --git a/ChangeLog b/ChangeLog index 159b3618..83428c3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ + * Changed directory structure. "trompeloeil.hpp" now resides in + directory "include". Self test programs "compiling_tests.cpp" + and "thread_terror.cpp" resides in directory "test". + + * Major work on CMake support + - "make install" - works as before and also includes a package + - For CMake based project you can use + . "find_package(trompeloeil 27 REQUIRED)" and add + "target_link_libraries( trompeloeil)" for your test + target + . use "add_subdirectory(trompeloeil)" if you prefer to track + the trompeloeil git repository and also here add + "target_link_libraries( trompeloeil)" for your test + target + - "cmake -DBUILD_TYPE=Debug " enables the test + targets "self_test" and "thread_terror" + . "-DSANITIZE" enables ASAN and UBSAN for "self_test", and TSAN and + UBSAN for "thread_terror" + v27 2017-06-27 * Fixed a regression where NAMED_REQUIRE_DESTRUCTION(obj) accidentally diff --git a/README.md b/README.md index 680f14cb..a9fe5ea3 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ ![trompeloeil logo](trompeloeil-logo.png) [![Build Status](https://travis-ci.org/rollbear/trompeloeil.svg?branch=master)](https://travis-ci.org/rollbear/trompeloeil) [![Coverage Status](https://coveralls.io/repos/rollbear/trompeloeil/badge.svg?branch=master&service=github)](https://coveralls.io/github/rollbear/trompeloeil?branch=master) -[![badge](https://img.shields.io/badge/conan.io-trompeloeil%2Fv27-green.svg?logo=data:image/png;base64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAA1VBMVEUAAABhlctjlstkl8tlmMtlmMxlmcxmmcxnmsxpnMxpnM1qnc1sn85voM91oM11oc1xotB2oc56pNF6pNJ2ptJ8ptJ8ptN9ptN8p9N5qNJ9p9N9p9R8qtOBqdSAqtOAqtR%2BrNSCrNJ/rdWDrNWCsNWCsNaJs9eLs9iRvNuVvdyVv9yXwd2Zwt6axN6dxt%2Bfx%2BChyeGiyuGjyuCjyuGly%2BGlzOKmzOGozuKoz%2BKqz%2BOq0OOv1OWw1OWw1eWx1eWy1uay1%2Baz1%2Baz1%2Bez2Oe02Oe12ee22ujUGwH3AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBQkREyOxFIh/AAAAiklEQVQI12NgAAMbOwY4sLZ2NtQ1coVKWNvoc/Eq8XDr2wB5Ig62ekza9vaOqpK2TpoMzOxaFtwqZua2Bm4makIM7OzMAjoaCqYuxooSUqJALjs7o4yVpbowvzSUy87KqSwmxQfnsrPISyFzWeWAXCkpMaBVIC4bmCsOdgiUKwh3JojLgAQ4ZCE0AMm2D29tZwe6AAAAAElFTkSuQmCC)](https://www.conan.io/source/trompeloeil/v27/rollbear/stable) -[![badge](https://img.shields.io/badge/conan.io-trompeloeil%2Fdevelop-green.svg?logo=data:image/png;base64%2CiVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAA1VBMVEUAAABhlctjlstkl8tlmMtlmMxlmcxmmcxnmsxpnMxpnM1qnc1sn85voM91oM11oc1xotB2oc56pNF6pNJ2ptJ8ptJ8ptN9ptN8p9N5qNJ9p9N9p9R8qtOBqdSAqtOAqtR%2BrNSCrNJ/rdWDrNWCsNWCsNaJs9eLs9iRvNuVvdyVv9yXwd2Zwt6axN6dxt%2Bfx%2BChyeGiyuGjyuCjyuGly%2BGlzOKmzOGozuKoz%2BKqz%2BOq0OOv1OWw1OWw1eWx1eWy1uay1%2Baz1%2Baz1%2Bez2Oe02Oe12ee22ujUGwH3AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfgBQkREyOxFIh/AAAAiklEQVQI12NgAAMbOwY4sLZ2NtQ1coVKWNvoc/Eq8XDr2wB5Ig62ekza9vaOqpK2TpoMzOxaFtwqZua2Bm4makIM7OzMAjoaCqYuxooSUqJALjs7o4yVpbowvzSUy87KqSwmxQfnsrPISyFzWeWAXCkpMaBVIC4bmCsOdgiUKwh3JojLgAQ4ZCE0AMm2D29tZwe6AAAAAElFTkSuQmCC)](https://www.conan.io/source/trompeloeil/develop/rollbear/testing) + > *trompe l'oeil* noun (Concise Encyclopedia) > Style of representation in which a painted object is intended diff --git a/check_errors.sh b/check_errors.sh index 232a7d71..f08fff1e 100755 --- a/check_errors.sh +++ b/check_errors.sh @@ -3,7 +3,7 @@ # # Trompeloeil C++ mocking framework # -# Copyright Björn Fahller 2014-2015 +# Copyright Björn Fahller 2014-2017 # # Use, modification and distribution is subject to the # Boost Software License, Version 1.0. (See accompanying @@ -22,14 +22,13 @@ FAILURES=0 #echo "CPPFLAGS=$CPPFLAGS" #${CXX} --version - cd compilation_errors for f in *.cpp do RE=$(sed -n 's:^//\(.*\)$:\1:g;T;P' < $f) printf "%-45s" $f - ${CXX} ${CXXFLAGS} ${CPPFLAGS} -std=c++14 $f -c |& egrep -q "$RE" && echo $PASS && continue || echo $FAIL && false + ${CXX} ${CXXFLAGS} ${CPPFLAGS} -I ../include -std=c++14 $f -c |& egrep -q "$RE" && echo $PASS && continue || echo $FAIL && false FAILURES=$((FAILURES+$?)) done exit $FAILURES diff --git a/compilation_errors/address_of_illegal_argument.cpp b/compilation_errors/address_of_illegal_argument.cpp index 0d23bb13..d2a5255f 100644 --- a/compilation_errors/address_of_illegal_argument.cpp +++ b/compilation_errors/address_of_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2016 + * Copyright Björn Fahller 2016,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/assign_illegal_argument.cpp b/compilation_errors/assign_illegal_argument.cpp index d36d1a49..ad0a0345 100644 --- a/compilation_errors/assign_illegal_argument.cpp +++ b/compilation_errors/assign_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2016 + * Copyright Björn Fahller 2016,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/deathwatched_with_nonvirtual_destructor.cpp b/compilation_errors/deathwatched_with_nonvirtual_destructor.cpp index 1a8f60c0..de039dc6 100644 --- a/compilation_errors/deathwatched_with_nonvirtual_destructor.cpp +++ b/compilation_errors/deathwatched_with_nonvirtual_destructor.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //virtual destructor is a necessity for deathwatched to work -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/dereference_illegal_argument.cpp b/compilation_errors/dereference_illegal_argument.cpp index 1a70a709..1ea8c34d 100644 --- a/compilation_errors/dereference_illegal_argument.cpp +++ b/compilation_errors/dereference_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2016 + * Copyright Björn Fahller 2016,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/expectation_with_unknown_func_name.cpp b/compilation_errors/expectation_with_unknown_func_name.cpp index 00cd4507..27092b45 100644 --- a/compilation_errors/expectation_with_unknown_func_name.cpp +++ b/compilation_errors/expectation_with_unknown_func_name.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //no member named.*x -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/expectation_with_wrong_cardinality.cpp b/compilation_errors/expectation_with_wrong_cardinality.cpp index 0d3db7c7..3c13c711 100644 --- a/compilation_errors/expectation_with_wrong_cardinality.cpp +++ b/compilation_errors/expectation_with_wrong_cardinality.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //function.*call -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/expectation_with_wrong_type.cpp b/compilation_errors/expectation_with_wrong_type.cpp index 046a17c1..30a9b71c 100644 --- a/compilation_errors/expectation_with_wrong_type.cpp +++ b/compilation_errors/expectation_with_wrong_type.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //argument.*2 -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/in_sequence_on_forbidden_call.cpp b/compilation_errors/in_sequence_on_forbidden_call.cpp index 8fb71651..82067a5f 100644 --- a/compilation_errors/in_sequence_on_forbidden_call.cpp +++ b/compilation_errors/in_sequence_on_forbidden_call.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //IN_SEQUENCE for forbidden call does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/make_mock_with_wrong_cardinality.cpp b/compilation_errors/make_mock_with_wrong_cardinality.cpp index 8de2aee0..92e58eb8 100644 --- a/compilation_errors/make_mock_with_wrong_cardinality.cpp +++ b/compilation_errors/make_mock_with_wrong_cardinality.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //Function signature does not have 2 parameters -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/missing_return_on_non_void_func.cpp b/compilation_errors/missing_return_on_non_void_func.cpp index 88786909..f8444ca2 100644 --- a/compilation_errors/missing_return_on_non_void_func.cpp +++ b/compilation_errors/missing_return_on_non_void_func.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN missing for non-void function -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_late_return_on_non_void_func.cpp b/compilation_errors/multiple_late_return_on_non_void_func.cpp index ab0dfefe..7d3ab723 100644 --- a/compilation_errors/multiple_late_return_on_non_void_func.cpp +++ b/compilation_errors/multiple_late_return_on_non_void_func.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //Multiple RETURN does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_limits.cpp b/compilation_errors/multiple_limits.cpp index 8237b030..63d091e2 100644 --- a/compilation_errors/multiple_limits.cpp +++ b/compilation_errors/multiple_limits.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //Only one TIMES call limit is allowed, but it can express an interval -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_return_on_non_void_func.cpp b/compilation_errors/multiple_return_on_non_void_func.cpp index 7ceb1d72..00c60acc 100644 --- a/compilation_errors/multiple_return_on_non_void_func.cpp +++ b/compilation_errors/multiple_return_on_non_void_func.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //Multiple RETURN does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_sequences.cpp b/compilation_errors/multiple_sequences.cpp index 6f77eb13..24f37a40 100644 --- a/compilation_errors/multiple_sequences.cpp +++ b/compilation_errors/multiple_sequences.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //Multiple IN_SEQUENCE does not make sense. You can list several sequence -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_sequences_destruction.cpp b/compilation_errors/multiple_sequences_destruction.cpp index 219a0cf2..b24829cc 100644 --- a/compilation_errors/multiple_sequences_destruction.cpp +++ b/compilation_errors/multiple_sequences_destruction.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //Multiple IN_SEQUENCE does not make sense. You can list several sequence -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_sequences_named_destruction.cpp b/compilation_errors/multiple_sequences_named_destruction.cpp index 22d4deec..5179b485 100644 --- a/compilation_errors/multiple_sequences_named_destruction.cpp +++ b/compilation_errors/multiple_sequences_named_destruction.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //Multiple IN_SEQUENCE does not make sense. You can list several sequence -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/multiple_throws.cpp b/compilation_errors/multiple_throws.cpp index 74a1391d..9be4f315 100644 --- a/compilation_errors/multiple_throws.cpp +++ b/compilation_errors/multiple_throws.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //Multiple THROW does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/negative_limit_interval_first.cpp b/compilation_errors/negative_limit_interval_first.cpp index 9cd43ea1..5ebdd080 100644 --- a/compilation_errors/negative_limit_interval_first.cpp +++ b/compilation_errors/negative_limit_interval_first.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //In TIMES the first value must not exceed the second -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/negative_limit_interval_second.cpp b/compilation_errors/negative_limit_interval_second.cpp index 9cd43ea1..5ebdd080 100644 --- a/compilation_errors/negative_limit_interval_second.cpp +++ b/compilation_errors/negative_limit_interval_second.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -12,7 +12,7 @@ */ //In TIMES the first value must not exceed the second -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_address_of_illegal_argument.cpp b/compilation_errors/return_address_of_illegal_argument.cpp index 00d6d06c..b2f4dc55 100644 --- a/compilation_errors/return_address_of_illegal_argument.cpp +++ b/compilation_errors/return_address_of_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015,2016 + * Copyright Björn Fahller 2015-2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_and_throw.cpp b/compilation_errors/return_and_throw.cpp index f95f520c..1edfd00b 100644 --- a/compilation_errors/return_and_throw.cpp +++ b/compilation_errors/return_and_throw.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //THROW and RETURN does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_first_from_void_func.cpp b/compilation_errors/return_first_from_void_func.cpp index b9c11b74..9001df8f 100644 --- a/compilation_errors/return_first_from_void_func.cpp +++ b/compilation_errors/return_first_from_void_func.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN does not make sense for void-function -#include "../trompeloeil.hpp" +#include struct MS diff --git a/compilation_errors/return_illegal_argument.cpp b/compilation_errors/return_illegal_argument.cpp index ef19cfa4..54d8e3a1 100644 --- a/compilation_errors/return_illegal_argument.cpp +++ b/compilation_errors/return_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_on_forbidden_call.cpp b/compilation_errors/return_on_forbidden_call.cpp index 5c9573f0..a45cdc88 100644 --- a/compilation_errors/return_on_forbidden_call.cpp +++ b/compilation_errors/return_on_forbidden_call.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN for forbidden call does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_second_from_void_func.cpp b/compilation_errors/return_second_from_void_func.cpp index 6bab2206..fbfa5ef1 100644 --- a/compilation_errors/return_second_from_void_func.cpp +++ b/compilation_errors/return_second_from_void_func.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN does not make sense for void-function -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_value_to_ref.cpp b/compilation_errors/return_value_to_ref.cpp index 48782071..9c565034 100644 --- a/compilation_errors/return_value_to_ref.cpp +++ b/compilation_errors/return_value_to_ref.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2016 + * Copyright Björn Fahller 2016,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN non-reference from function returning reference -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_wrong_pointer_constness.cpp b/compilation_errors/return_wrong_pointer_constness.cpp index e864dff5..c81998d0 100644 --- a/compilation_errors/return_wrong_pointer_constness.cpp +++ b/compilation_errors/return_wrong_pointer_constness.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN const\* from function returning pointer to non-const -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_wrong_reference_constness.cpp b/compilation_errors/return_wrong_reference_constness.cpp index 1ac69913..1fad17bc 100644 --- a/compilation_errors/return_wrong_reference_constness.cpp +++ b/compilation_errors/return_wrong_reference_constness.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN const\& from function returning non-const reference -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/return_wrong_type_first.cpp b/compilation_errors/return_wrong_type_first.cpp index b881ad81..75d20ab6 100644 --- a/compilation_errors/return_wrong_type_first.cpp +++ b/compilation_errors/return_wrong_type_first.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014,2015 + * Copyright Björn Fahller 2014,2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN value is not convertible to the return type of the function -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/side_effect_on_forbidden_call.cpp b/compilation_errors/side_effect_on_forbidden_call.cpp index c693481a..0f182fd5 100644 --- a/compilation_errors/side_effect_on_forbidden_call.cpp +++ b/compilation_errors/side_effect_on_forbidden_call.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //SIDE_EFFECT for forbidden call does not make sense -#include "../trompeloeil.hpp" +#include #include struct MS diff --git a/compilation_errors/throw_and_return.cpp b/compilation_errors/throw_and_return.cpp index 3b3acd91..102d5d2d 100644 --- a/compilation_errors/throw_and_return.cpp +++ b/compilation_errors/throw_and_return.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2014 + * Copyright Björn Fahller 2014,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //THROW and RETURN does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/throw_on_forbidden_call.cpp b/compilation_errors/throw_on_forbidden_call.cpp index 5852919b..74fac81b 100644 --- a/compilation_errors/throw_on_forbidden_call.cpp +++ b/compilation_errors/throw_on_forbidden_call.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //THROW for forbidden call does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/times_0_after_return.cpp b/compilation_errors/times_0_after_return.cpp index 48e5020b..15c155e7 100644 --- a/compilation_errors/times_0_after_return.cpp +++ b/compilation_errors/times_0_after_return.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //RETURN and TIMES\(0\) does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/times_0_after_sequence.cpp b/compilation_errors/times_0_after_sequence.cpp index bf749b07..46d71c4b 100644 --- a/compilation_errors/times_0_after_sequence.cpp +++ b/compilation_errors/times_0_after_sequence.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //IN_SEQUENCE and TIMES\(0\) does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/times_0_after_side_effect.cpp b/compilation_errors/times_0_after_side_effect.cpp index 16070e43..9e25fa22 100644 --- a/compilation_errors/times_0_after_side_effect.cpp +++ b/compilation_errors/times_0_after_side_effect.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //SIDE_EFFECT and TIMES\(0\) does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/times_0_after_throw.cpp b/compilation_errors/times_0_after_throw.cpp index 46b328ad..d3d0c705 100644 --- a/compilation_errors/times_0_after_throw.cpp +++ b/compilation_errors/times_0_after_throw.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015 + * Copyright Björn Fahller 2015,2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //THROW and TIMES\(0\) does not make sense -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/compilation_errors/use_illegal_argument.cpp b/compilation_errors/use_illegal_argument.cpp index 3aa7956e..cb212214 100644 --- a/compilation_errors/use_illegal_argument.cpp +++ b/compilation_errors/use_illegal_argument.cpp @@ -1,7 +1,7 @@ /* * Trompeloeil C++ mocking framework * - * Copyright Björn Fahller 2015,2016 + * Copyright Björn Fahller 2015-2017 * * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying @@ -13,7 +13,7 @@ //illegal argument -#include "../trompeloeil.hpp" +#include struct MS { diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..9488c4cc --- /dev/null +++ b/conanfile.py @@ -0,0 +1,30 @@ +# +# Trompeloeil C++ mocking framework +# +# Copyright Bjorn Fahller 2017 +# +# Use, modification and distribution is subject to 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) +# +# Project home: https://github.com/rollbear/trompeloeil +# + +from conans import ConanFile, tools +import os + + +class TrompeloelConan(ConanFile): + name = "trompeloeil" + version = "v28" + license = "Boost Software License - Version 1.0 - August 17th, 2003" + url = "https://github.com/rollbear/trompeloeil.git" + description = "Header only C++14 mocking framework" + exports_sources = "include/*.hpp", "LICENCE*.txt" + # No settings/options are necessary, this is header only + + + def package(self): + self.copy("*.hpp", src="include", dst="include") + self.copy("LICENSE*.txt", dst="licenses") diff --git a/trompeloeil.hpp b/include/trompeloeil.hpp similarity index 99% rename from trompeloeil.hpp rename to include/trompeloeil.hpp index 830d5985..30627b09 100644 --- a/trompeloeil.hpp +++ b/include/trompeloeil.hpp @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef TROMPELOEIL_SANITY_CHECKS #include diff --git a/compiling_tests.cpp b/test/compiling_tests.cpp similarity index 99% rename from compiling_tests.cpp rename to test/compiling_tests.cpp index 72f01732..7524b541 100644 --- a/compiling_tests.cpp +++ b/test/compiling_tests.cpp @@ -12,7 +12,7 @@ */ #define TROMPELOEIL_SANITY_CHECKS -#include "trompeloeil.hpp" +#include #define CATCH_CONFIG_MAIN #include #include diff --git a/thread_terror.cpp b/test/thread_terror.cpp similarity index 90% rename from thread_terror.cpp rename to test/thread_terror.cpp index b77a9770..b535517f 100644 --- a/thread_terror.cpp +++ b/test/thread_terror.cpp @@ -1,4 +1,4 @@ -#include "trompeloeil.hpp" +#include #include #include #include @@ -76,7 +76,7 @@ void allow(size_t count, int id) int main() { - trompeloeil::set_reporter([](auto s, auto file, auto line, auto& msg) + trompeloeil::set_reporter([](auto , auto , auto, auto&) { abort(); }); @@ -103,5 +103,7 @@ int main() std::copy(std::begin(ret_count), std::end(ret_count), std::ostream_iterator(std::cout, " ")); std::cout << "\n"; + assert(std::equal(std::begin(call_count), std::end(call_count), + std::begin(ret_count), std::end(ret_count))); obj.reset(); } diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 00000000..75439b71 --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +project(PackageTest CXX) +cmake_minimum_required(VERSION 2.8.12) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(example example.cpp) +target_link_libraries(example ${CONAN_LIBS}) + diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 00000000..77bc040e --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +import os + +class TrompeloeilTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + # Current dir is "test_package/build/" and CMakeLists.txt is in "test_package" + cmake.configure(source_dir=self.conanfile_directory, build_dir="./") + cmake.build() + + def imports(self): + self.copy("*.dll", dst="bin", src="bin") + self.copy("*.dylib*", dst="bin", src="lib") + + def test(self): + os.chdir("bin") + self.run(".%sexample" % os.sep) diff --git a/test_package/example.cpp b/test_package/example.cpp new file mode 100644 index 00000000..356b5355 --- /dev/null +++ b/test_package/example.cpp @@ -0,0 +1,12 @@ +#include + +struct S +{ + MAKE_MOCK1(func, void(int)); +}; + +int main() { + S s; + REQUIRE_CALL(s, func(3)); + s.func(3); +} diff --git a/trompeloeil-config.cmake b/trompeloeil-config.cmake new file mode 100644 index 00000000..f38465db --- /dev/null +++ b/trompeloeil-config.cmake @@ -0,0 +1,2 @@ +include( "${CMAKE_CURRENT_LIST_DIR}/trompeloeil-targets.cmake" ) +