Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
29dc152
Update to use latest Cucumber-Ruby and RSpec matchers
paoloambrosio Jun 21, 2014
e2de968
random
konserw Jan 14, 2016
c2d92ae
working rspec 3.4.0
konserw Jan 14, 2016
6d5087b
fix some deprected functions
konserw Jan 8, 2016
8a9f675
fixed failing feature with aruba > 6.1 - not sure if OK
konserw Jan 14, 2016
9adc18b
reverted skipping of unit tests
konserw Jan 14, 2016
89b276c
fix for aruba 8.0 - not sure if OK
konserw Jan 14, 2016
756f56a
update to latest working cucumber
konserw Jan 14, 2016
37afea3
fix deprected warnings
konserw Jan 14, 2016
7ebb8ac
Merge branch 'ci' into ci_merge
konserw Jan 16, 2016
24ee3c9
own fork of cucumber-tck
konserw Jan 19, 2016
9acca90
This commits the fixed-up submodule entry.
konserw Jan 19, 2016
4173c0e
[cucumber-tck]fixed #current_directory deprected warnings
konserw Jan 19, 2016
da603cf
do not build this branch
konserw Feb 7, 2016
0fda9a3
Paolo's try on appveyor
paoloambrosio Jan 8, 2016
cbda64b
My try on appveyor
konserw Jan 28, 2016
1d2ea5c
check features target
konserw Feb 26, 2016
12049fb
escape paths while building functional-steps
konserw Feb 26, 2016
f724c31
try relative path
konserw Feb 26, 2016
a2ed39a
fixed path to build folder
konserw Feb 26, 2016
323e10d
add debug/release dir prefix to features target
konserw Feb 26, 2016
2e2804e
better handling of debug/release output dir
konserw Feb 26, 2016
636fc5c
beter kill procedure for steps?
konserw Feb 26, 2016
7e931ed
diasable features target
konserw Feb 26, 2016
083e989
naother try on killing steps process
konserw Feb 26, 2016
5306e2a
cucumber path
konserw Feb 26, 2016
0451c0a
add ruby 2.2
konserw Feb 27, 2016
6f1cf08
THROW ARUBA AWAY
konserw Feb 27, 2016
d1b26c7
add second boost version
konserw Feb 27, 2016
69cad5a
fix environment matrix
konserw Feb 27, 2016
268bfe0
fixed checking of return status
konserw Feb 27, 2016
51d0f6b
fix appveyor rubyversions switching
konserw Feb 27, 2016
dac49ff
ruby 20 should work better then 2.2, less output from gem
konserw Feb 28, 2016
c395e79
Merge branch 'own_tck' into app
konserw Feb 28, 2016
1b29ec4
fixed failing steps within cucumber-tck
konserw Feb 28, 2016
a6b84c4
fixCucumber ansicon for cucumber 2.0
konserw Feb 28, 2016
17339f2
fix failing step on windows
konserw Feb 28, 2016
f9ed162
show output
konserw Feb 28, 2016
8af63cf
another try on fixing thei18n feature
konserw Feb 28, 2016
9bf4717
remove debug output
konserw Feb 28, 2016
073a450
shut up postinstall messages
konserw Feb 29, 2016
2debcb0
cleanups
konserw Feb 29, 2016
40a4171
check flags
konserw Mar 1, 2016
29ea93f
cleanups
konserw Mar 1, 2016
b490d92
move shut up gem to build scripts
konserw Mar 1, 2016
e3352a4
check variables again
konserw Mar 1, 2016
bffbb34
remove os gem
konserw Mar 1, 2016
844b720
Moving step definition process kill out as a hook
paoloambrosio Mar 1, 2016
9f1c891
CMakeLists cleaned up based on sugestions from #97
konserw Mar 1, 2016
e3d3edf
Revert "Moving step definition process kill out as a hook"
konserw Mar 2, 2016
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# vim swap files
*.swp
# Qt Creator
CMakeLists.txt.user

Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "features/cucumber-tck"]
path = features/cucumber-tck
url = git://github.com/cucumber/cucumber-tck.git
url = https://github.com/konserw/cucumber-tck.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to upgrade to the latest Cucumber/RSpec/Aruba, right? I'll create a branch in cucumber-tck for that so that we can reference an official branch. I also think this deserves its own PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created branch cucumber-cpp in cucumber-tck

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ script: ./travis.sh
notifications:
email:
- cukes-devs@googlegroups.com

branches:
only:
- master
41 changes: 34 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,27 @@ if(CMAKE_COMPILER_IS_GNUCXX)
# TODO: A better fix should handle ld's --as-needed flag
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xlinker '--no-as-needed'")
elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX") # exclude M$ min/max macros
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /analyze")
add_definitions(-DNOMINMAX) # exclude M$ min/max macros
add_definitions(-D_SCL_SECURE_NO_WARNINGS) #turn off msvc warning
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS) #likewise
# link_directories("C:/Libraries/boost/lib32-msvc-12.0")
# add_definitions(-D_WIN32_WINNT=0x0600) #windows vista
set(variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
endif()

#
Expand All @@ -47,22 +66,28 @@ if(NOT CUKE_DISABLE_BOOST_TEST)
endif()

if(CUKE_USE_STATIC_BOOST)
message(STATUS "Using STATIC BOOST")
set(CUKE_STATIC_BOOST_LIBS ${CUKE_CORE_BOOST_LIBS})
# "An external test runner utility is required to link with dynamic library" (Boost User's Guide)
set(CUKE_DYNAMIC_BOOST_LIBS ${CUKE_TEST_BOOST_LIBS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")
if(NOT CUKE_DISABLE_BOOST_TEST)
set(CUKE_DYNAMIC_BOOST_LIBS ${CUKE_TEST_BOOST_LIBS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")
endif()

if(NOT MSVC)
find_package(Threads)
set(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
else()
message(STATUS "Using DYNAMIC BOOST")
set(CUKE_DYNAMIC_BOOST_LIBS ${CUKE_CORE_BOOST_LIBS} ${CUKE_TEST_BOOST_LIBS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_DYN_LINK")
endif()

if(CUKE_STATIC_BOOST_LIBS)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
set (Boost_MULTITHREADED ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to static linking and to the Windows build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - on windows only way I could get it running was to statically (with multithread - /MT) link everything

find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_STATIC_BOOST_LIBS})
endif()

Expand Down Expand Up @@ -148,16 +173,18 @@ if(NOT CUKE_DISABLE_FUNCTIONAL)
add_executable(functional-steps EXCLUDE_FROM_ALL ${CUKE_DYNAMIC_CPP_STEPS})
target_link_libraries(functional-steps ${CUKE_LIBRARIES})

# TODO It does not escape paths
set(CUKE_COMPILE_DYNAMIC_CPP_STEPS "${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target functional-steps")

set(CUKE_COMPILE_DYNAMIC_CPP_STEPS "cmake --build ${CMAKE_BINARY_DIR} --target functional-steps")
if(VERBOSE)
message(STATUS, "compile dnamic steps command: ${CUKE_COMPILE_DYNAMIC_CPP_STEPS}")
message(STATUS, "cucumber: ${CUCUMBER_RUBY}")
endif()
function(add_feature_target TARGET_NAME)
add_custom_target(${TARGET_NAME}
COMMAND ${CUCUMBER_RUBY}
TEST_FEATURES_DIR=${CUKE_TEST_FEATURES_DIR}
TMP_DIR=${CUKE_FEATURES_TMP}
DYNAMIC_CPP_STEPS_SRC=${CUKE_DYNAMIC_CPP_STEPS}
DYNAMIC_CPP_STEPS_EXE=${CMAKE_BINARY_DIR}/functional-steps
DYNAMIC_CPP_STEPS_EXE="${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/functional-steps"
COMPILE_DYNAMIC_CPP_STEPS=${CUKE_COMPILE_DYNAMIC_CPP_STEPS}
${ARGV1} ${ARGV2} ${ARGV3} ${ARGV4} ${ARGV5} ${ARGV6}
${CUKE_FEATURES_DIR}
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
source 'https://rubygems.org'

group :test do
gem 'cucumber', "=1.3.20"
gem 'aruba', "=0.6.1"
gem 'rspec', "=2.14.1"
gem 'cucumber', "=2.0.0"
gem 'aruba', "=0.8.0"
gem 'rspec', "=3.4.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK as a separate PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is in #93 already!

end

53 changes: 53 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: "{branch}-ci-{build}"
os:
- Visual Studio 2013

platform:
- Win32

configuration:
- Debug
- Release

on_finish:
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

environment:
matrix:
- BOOST_ROOT: C:\Libraries\boost
BOOST_INCLUDEDIR: C:\Libraries\boost\boost
BOOST_LIBRARYDIR: C:\Libraries\boost\lib32-msvc-12.0
ruby_version: "193"
- BOOST_ROOT: C:\Libraries\boost_1_58_0
BOOST_INCLUDEDIR: C:\Libraries\boost_1_58_0\boost
BOOST_LIBRARYDIR: C:\Libraries\boost_1_58_0\lib32-msvc-12.0
ruby_version: "200"

install:
- git submodule init
- git submodule update
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
- ruby --version
- gem update --system --no-ri --no-rdoc -q > gem.log
- gem install gem-shut-the-fuck-up
- gem install bundler --no-document
- bundle install
- ps: .\fixCucumber.ps1

build_script:
- cmake -E make_directory build
- cmake -E chdir build cmake -DAPPVEYOR=on -DVERBOSE=on -DCUKE_ENABLE_EXAMPLES=on -DCUKE_DISABLE_BOOST_TEST=on -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
- cmake --build build

test_script:
- cmake --build build --target RUN_TESTS
- cmake --build build --target features

notifications:
- provider: Email
to:
- cukes-devs@googlegroups.com
subject: "[cucumber-cpp] AppVeyor Build {version}"
on_build_success: false
on_build_failure: true
on_build_status_changed: true
4 changes: 1 addition & 3 deletions cmake/modules/FindGMock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ add_dependencies(libgmock gmock)
ExternalProject_Get_Property(gmock source_dir binary_dir)

if(MSVC)
set(MS_DIR "/${CMAKE_BUILD_TYPE}")
set(MS_DIR "/${CMAKE_CFG_INTDIR}")
endif()

set(GTEST_LIB_DIR "${binary_dir}/gtest${MS_DIR}")
set(GMOCK_LIB_DIR "${binary_dir}${MS_DIR}")

Expand Down Expand Up @@ -219,4 +218,3 @@ if(GTEST_FOUND)
Message(STATUS "GTest libs: ${GTEST_BOTH_LIBRARIES}")
endif()
endif()

71 changes: 45 additions & 26 deletions features/step_definitions/cucumber_cpp_mappings.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'json'

module CucumberCppMappings
Expand Down Expand Up @@ -131,33 +133,47 @@ def write_mapping_calling_world_function(step_name)
EOF
end

def assert_returned_success
expect(@return).to be == true
end

def assert_passing_feature
assert_no_partial_output("failed", @output.encode('UTF-8'))
expect(@return).to be == true
end

def assert_failing_feature(message)
assert_partial_output(message, @output)
expect(@return).to be == false
end

def assert_passing_scenario
assert_partial_output("1 scenario (1 passed)", all_output)
assert_success true
assert_partial_output("1 scenario (1 passed)", @output)
expect(@return).to be == true
end

def assert_failing_scenario
assert_partial_output("1 scenario (1 failed)", all_output)
assert_success false
assert_partial_output("1 scenario (1 failed)", @output)
expect(@return).to be == false
end

def assert_pending_scenario
assert_partial_output("1 scenario (1 pending)", all_output)
assert_success true
assert_partial_output("1 scenario (1 pending)", @output)
expect(@return).to be == true
end

def assert_undefined_scenario
assert_partial_output("1 scenario (1 undefined)", all_output)
assert_success true
assert_partial_output("1 scenario (1 undefined)", @output)
expect(@return).to be == true
end

def assert_scenario_reported_as_failing(scenario_name)
assert_partial_output("# Scenario: #{scenario_name}", all_output)
assert_success false
assert_partial_output("# Scenario: #{scenario_name}", @output)
expect(@return).to be == false
end

def assert_scenario_not_reported_as_failing(scenario_name)
assert_no_partial_output("# Scenario: #{scenario_name}", all_output)
assert_no_partial_output("# Scenario: #{scenario_name}", @output)
end

def assert_suggested_step_definition_snippet(stepdef_keyword, stepdef_pattern, parameter_count = 0, doc_string = false, data_table = false)
Expand All @@ -172,36 +188,34 @@ def assert_executed_scenarios *scenario_offsets
end

def assert_world_variable_held_value_at_time(value, time)
check_exact_file_content "#{WORLD_VARIABLE_LOG_FILE}.#{time}", value
expect(File.read("#{WORLD_VARIABLE_LOG_FILE}.#{time}")).to match value
end

def assert_world_function_called
check_file_presence [WORLD_FUNCTION_LOG_FILE], true
expect(File.file?(WORLD_FUNCTION_LOG_FILE)).to be true
end

def assert_cycle_sequence *args
expected_string = args.join CYCLE_SEQUENCE_SEPARATOR
check_file_content(CYCLE_LOG_FILE, expected_string, true)
expect(File.read(CYCLE_LOG_FILE)).to match expected_string
end

def assert_cycle_sequence_excluding *args
args.each do |unexpected_string|
check_file_content(CYCLE_LOG_FILE, unexpected_string, false)
expect(File.read(CYCLE_LOG_FILE)).not_to match unexpected_string
end
end

def assert_complete_cycle_sequence *args
expected_string = "#{CYCLE_SEQUENCE_SEPARATOR}#{args.join(CYCLE_SEQUENCE_SEPARATOR)}"
check_exact_file_content(CYCLE_LOG_FILE, expected_string)
expect(File.read(CYCLE_LOG_FILE)).to match expected_string
end

def assert_data_table_equals_json(json)
prep_for_fs_check do
log_file_contents = IO.read(DATA_TABLE_LOG_FILE)
actual_array = JSON.parse(log_file_contents)
expected_array = JSON.parse(json)
actual_array.should == expected_array
end
log_file_contents = File.read(DATA_TABLE_LOG_FILE)
actual_array = JSON.parse(log_file_contents)
expected_array = JSON.parse(json)
expect(actual_array).to be == expected_array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what prep_for_fs_check does so not sure what this improves/fixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end

def run_feature
Expand Down Expand Up @@ -292,8 +306,11 @@ def run_feature_with_params(params)
create_wire_file
run_cucumber_cpp
run_cucumber_test_feature params
Process.kill(:SIGTERM, @steps_out.pid) # for when there are no scenarios
Process.wait @steps_out.pid
begin
Process.kill(9, @steps_out.pid)
Process.wait @steps_out.pid
rescue Errno::ESRCH
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've introduced something similar as an after hook in PR #102

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take it from there ;)

end

def write_main_step_definitions_file
Expand All @@ -302,7 +319,7 @@ def write_main_step_definitions_file

def compile_step_definitions
compiler_output = %x[ #{COMPILE_STEP_DEFINITIONS_CMD} ]
expect($?.success?).to be_true, "Compilation failed!\n#{compiler_output}"
expect($?.success?).to be == true, "Compilation failed!\n#{compiler_output}"
end

def create_wire_file
Expand All @@ -317,7 +334,9 @@ def run_cucumber_cpp
end

def run_cucumber_test_feature(params)
run_simple "cucumber #{params} #{FEATURES_DIR}", false
cmd="cucumber #{params} #{FEATURES_DIR}"
@output = %x[ #{cmd} ]
@return = ($?.success?)
end
end

Expand Down
9 changes: 9 additions & 0 deletions fixCucumber.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
If ($env:ruby_version -match "200") {
$path = "C:\Ruby200\lib\ruby\gems\2.0.0\gems\cucumber-2.0.0\lib\cucumber\formatter\ansicolor.rb"
} Else {
$path = "C:\Ruby193\lib\ruby\gems\1.9.1\gems\cucumber-2.0.0\lib\cucumber\formatter\ansicolor.rb"
}

(Get-Content $path) -replace '\ST\DERR.puts %', '#nope' | Set-Content $path
(Get-Content $path) -replace ' Cucumber::', '#nope' | Set-Content $path
(Get-Content $path) -replace '^Cucumber::', '#nope' | Set-Content $path
2 changes: 1 addition & 1 deletion src/drivers/GTestDriver.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cucumber-cpp/internal/drivers/GTestDriver.hpp>

#include <gtest/gtest.h>
#include "gtest/gtest.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A preprocessing directive of the form

  # include <h-char-sequence> new-line

searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the < and > delimiters, and causes the replacement of that directive by the entire contents of the header. How the places are specified or the header identified is implementation-defined.

A preprocessing directive of the form

  # include "q-char-sequence" new-line

causes the replacement of that directive by the entire contents of the source file identified by the specified sequence between the " delimiters. The named source file is searched for in an implementation-defined manner. If this search is not supported, or if the search fails, the directive is reprocessed as if it read

  # include <h-char-sequence> new-line

with the identical contained sequence (including > characters, if any) from the original directive.

So AFAIK when using "" in theory we prioritise current directory over system defined paths when searching for header.


namespace cucumber {
namespace internal {
Expand Down
1 change: 1 addition & 0 deletions travis.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -e #break script on non-zero exitcode from any command
gem install gem-shut-the-fuck-up
gem install bundler

cmake -E make_directory build
Expand Down