Commit d855fcd9 authored by Paolo Ambrosio's avatar Paolo Ambrosio
Browse files

Merge #118 'Removed support for CppSpec'

parents 5dd9b234 7119cc3b
......@@ -6,7 +6,6 @@ set(CUKE_USE_STATIC_BOOST ${MSVC} CACHE BOOL "Statically link Boost (except boos
set(CUKE_USE_STATIC_GTEST ON CACHE BOOL "Statically link Google Test")
set(CUKE_DISABLE_BOOST_TEST OFF CACHE BOOL "Disable boost:test")
set(CUKE_DISABLE_CPPSPEC OFF CACHE BOOL "Disable CppSpec")
set(CUKE_DISABLE_GTEST OFF CACHE BOOL "Disable Google Test framework")
set(CUKE_DISABLE_UNIT_TESTS OFF CACHE BOOL "Disable unit tests")
set(CUKE_DISABLE_E2E_TESTS OFF CACHE BOOL "Disable end-to-end tests")
......@@ -76,14 +75,6 @@ if(Boost_FOUND)
set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif()
#
# CppSpec
#
if(NOT CUKE_DISABLE_CPPSPEC)
find_package(CppSpec)
endif()
#
# GTest
#
......
......@@ -2,7 +2,7 @@
### New Features
None yet
* Removed CppSpec support ([#118](https://github.com/cucumber/cucumber-cpp/pull/118) Paolo Ambrosio)
### Bugfixes
......
......@@ -27,8 +27,6 @@ It relies on a few libraries:
Optional library for Boost Test driver: *test*.
* [GTest](http://code.google.com/p/googletest/) 1.6 or later.
Optional for the GTest driver. By default downloaded and built by CMake.
* [CppSpec](https://github.com/tpuronen/cppspec) development branch.
Optional for the CppSpec driver.
* [GMock](http://code.google.com/p/googlemock/) 1.6 or later.
Optional for the internal test suite. By default downloaded and built by CMake.
* [Qt 4 or 5](http://qt-project.org/). Optional for the CalcQt example.
......
# Locate CppSpec: Behaviour driven development with C++
#
# Defines the following variables:
#
# CPPSPEC_FOUND - Found CppSpec
# CPPSPEC_INCLUDE_DIR - Include directories
# CPPSPEC_LIBRARY - libCppSpec
#
find_path(CPPSPEC_INCLUDE_DIR CppSpec/CppSpec.h
HINTS
$ENV{CPPSPEC_ROOT}/include
${CPPSPEC_ROOT}/include
)
find_library(CPPSPEC_LIBRARY CppSpec
HINTS
$ENV{CPPSPEC_ROOT}/lib
${CPPSPEC_ROOT}/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CPPSPEC DEFAULT_MSG CPPSPEC_LIBRARY CPPSPEC_INCLUDE_DIR)
mark_as_advanced(CPPSPEC_LIBRARY CPPSPEC_INCLUDE_DIR)
......@@ -10,12 +10,6 @@ if(GMOCK_FOUND)
target_link_libraries(GTestCalculatorSteps Calc ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES})
endif()
if(CPPSPEC_FOUND)
include_directories(${CPPSPEC_INCLUDE_DIRS})
add_executable(CppSpecCalculatorSteps features/step_definitions/CppSpecCalculatorSteps)
target_link_libraries(CppSpecCalculatorSteps Calc ${CPPSPEC_LIBRARY} ${CUKE_LIBRARIES})
endif()
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(BoostCalculatorSteps features/step_definitions/BoostCalculatorSteps)
......
#include <CppSpec/CppSpec.h>
#include <cucumber-cpp/autodetect.hpp>
#include <Calculator.h>
using cucumber::ScenarioScope;
struct CalcCtx {
Calculator calc;
double result;
};
GIVEN("^I have entered (\\d+) into the calculator$") {
REGEX_PARAM(double, n);
ScenarioScope<CalcCtx> context;
context->calc.push(n);
}
WHEN("^I press add") {
ScenarioScope<CalcCtx> context;
context->result = context->calc.add();
}
WHEN("^I press divide") {
ScenarioScope<CalcCtx> context;
context->result = context->calc.divide();
}
THEN("^the result should be (.*) on the screen$") {
REGEX_PARAM(double, expected);
ScenarioScope<CalcCtx> context;
specify(context->result, should.equal(expected));
}
#ifndef CUKE_CPPSPECDRIVER_HPP_
#define CUKE_CPPSPECDRIVER_HPP_
#include "../step/StepManager.hpp"
namespace cucumber {
namespace internal {
class CppSpecStep : public BasicStep {
protected:
const InvokeResult invokeStepBody();
};
#define STEP_INHERITANCE(step_name) ::cucumber::internal::CppSpecStep, CppSpec::Specification<void, step_name >
}
}
#endif /* CUKE_CPPSPECDRIVER_HPP_ */
......@@ -2,6 +2,4 @@
#include "GTestDriver.hpp"
#elif defined(BOOST_TEST_CASE)
#include "BoostDriver.hpp"
#elif defined(CPPSPEC_H_)
#include "CppSpecDriver.hpp"
#endif
......@@ -20,11 +20,6 @@ if(GMOCK_FOUND)
list(APPEND CUKE_SOURCES drivers/GTestDriver.cpp)
endif()
if(CPPSPEC_FOUND)
include_directories(${CPPSPEC_INCLUDE_DIRS})
list(APPEND CUKE_SOURCES drivers/CppSpecDriver.cpp)
endif()
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
list(APPEND CUKE_SOURCES drivers/BoostDriver.cpp)
endif()
......
#include <cucumber-cpp/internal/drivers/CppSpecDriver.hpp>
#include <CppSpec/CppSpec.h>
namespace cucumber {
namespace internal {
const InvokeResult CppSpecStep::invokeStepBody() {
try {
body();
return InvokeResult::success();
} catch (const ::CppSpec::SpecifyFailedException &e) {
return InvokeResult::failure(e.message);
}
}
}
}
......@@ -39,10 +39,6 @@ if(GMOCK_FOUND)
cuke_add_driver_test(integration/drivers/GTestDriverTest ${CUKE_GTEST_LIBRARIES})
endif()
if(CPPSPEC_FOUND)
cuke_add_driver_test(integration/drivers/CppSpecDriverTest ${CPPSPEC_LIBRARY})
endif()
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
cuke_add_driver_test(integration/drivers/BoostDriverTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
endif()
......
#include <CppSpec/CppSpec.h>
#include <cucumber-cpp/autodetect.hpp>
#include "../../utils/DriverTestRunner.hpp"
using namespace cucumber;
THEN(SUCCEED_MATCHER) {
ScenarioScope<SomeContext> ctx;
specify(true, should.equal(true));
}
THEN(FAIL_MATCHER) {
ScenarioScope<SomeContext> ctx;
specify(true, should.equal(false));
}
THEN(PENDING_MATCHER_1) {
pending();
}
THEN(PENDING_MATCHER_2) {
pending(PENDING_DESCRIPTION);
}
using namespace cucumber::internal;
int main(int argc, char **argv) {
return DriverTest().run();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment