Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
1457b95
feat!: rewrite to use cucumber messages
daantimmer Dec 8, 2025
e8e9362
enable ccache
daantimmer Dec 12, 2025
792332e
disable the build of shared libs
daantimmer Dec 12, 2025
e8c96aa
disable position independent code generation for jbeder/yaml-cpp
daantimmer Dec 12, 2025
48d99c6
add additional launch tags
daantimmer Dec 12, 2025
1ae9468
add first version (empty, minimal and data-tables are enabled) of the…
daantimmer Dec 12, 2025
10137be
refactored a lot of code
daantimmer Dec 12, 2025
7ac6e9c
removed unused files
daantimmer Dec 12, 2025
77b4762
update devcontainers for CI
daantimmer Dec 12, 2025
50a2bce
removed agauniyal/rang from dependencies
daantimmer Dec 12, 2025
4054607
cleanup Application
daantimmer Dec 12, 2025
45a4380
sanitize and dump actual and expected json
daantimmer Dec 14, 2025
958e05c
set option variables for dependencies as cache variables
daantimmer Dec 14, 2025
6eb2da0
fix grouping for string parameter
daantimmer Dec 14, 2025
ece0b62
use ScopedFakeTestPartResultReporter instead of EmptyTestEventListene…
daantimmer Dec 14, 2025
6f1f4c8
Enable the following compatibility tests: ambiguous, backgrounds, cda…
daantimmer Dec 14, 2025
07a77d7
add examples-tables-attachment compatibility test
daantimmer Dec 15, 2025
028dcc5
add attachments compatibility test
daantimmer Dec 15, 2025
640986f
enabled examples-tables-undefined and global-hooks compatibility test
daantimmer Dec 16, 2025
cbb2f0c
Added global-hooks-afterall-error, global-hooks-attachments, global-h…
daantimmer Dec 17, 2025
dfe7157
add all compatibility checks by default regardless if a cpp implement…
daantimmer Dec 18, 2025
de2aaeb
add hooks-named, hooks-skipped and hooks-undefined compatibility tests
daantimmer Dec 18, 2025
d1a3e52
add multiple-features and multiple-features-reverses compatibility tests
daantimmer Dec 18, 2025
cad1bcf
Merge branch 'main' into feature/rewrite-to-use-cucumber-messages
daantimmer Dec 18, 2025
83c6e5a
fix clang-msvc build
daantimmer Dec 19, 2025
13484a5
fix clang-msvc build
daantimmer Dec 19, 2025
c7ee029
fix MSVC build
daantimmer Dec 19, 2025
4a9afab
fix MSVC build
daantimmer Dec 19, 2025
d11d0d0
add parameter-types compatibility tests
daantimmer Dec 22, 2025
78f70e1
add pending compatibility tests
daantimmer Dec 22, 2025
c67ebd4
fixed TestExpression tests
daantimmer Dec 22, 2025
323b2d4
fixed TestExpression tests
daantimmer Dec 22, 2025
3be881a
add retry, retry-ambiguous, retry-pending and retry-undefined compati…
daantimmer Dec 22, 2025
e94534c
add rules, rules-backgrounds and skipped compatibility tests
daantimmer Dec 22, 2025
c235f1a
add undefined, unknown-parameter-type and unused-steps compatibility …
daantimmer Dec 22, 2025
5893f62
fixed build issues and solved sonarcloud warnings
daantimmer Dec 23, 2025
d75b763
make URI cross-OS compatible
daantimmer Dec 23, 2025
917debc
remove compatibility kit from ls-lint
daantimmer Dec 23, 2025
5815b57
fix possible null-pointer dereference
daantimmer Dec 23, 2025
9986ec8
make uri's canonical
daantimmer Dec 23, 2025
c66a111
fixed const instead of static
daantimmer Dec 23, 2025
3e626e7
fix sonar warnings and replace \r\n with \n
daantimmer Dec 23, 2025
5c23d80
refactor RemoveIncompatibilities to improve iteration and const corre…
daantimmer Dec 23, 2025
1ad2458
refactor RemoveIncompatibilities to enhance iteration logic and ensur…
daantimmer Dec 23, 2025
e10babb
remove old reporters
daantimmer Dec 23, 2025
a56826e
remove unused stuff
daantimmer Dec 23, 2025
998dbd2
refactor to reduce nesting
daantimmer Dec 23, 2025
811ac18
refactory HookRegistry
daantimmer Dec 23, 2025
76ed6f4
refactored Parameter
daantimmer Dec 23, 2025
d61854c
refactored Query.hpp
daantimmer Dec 23, 2025
ba22049
removed TraceTime
daantimmer Dec 23, 2025
6a2492c
Refactored RunCucumber
daantimmer Dec 23, 2025
54278d0
minor refactorings
daantimmer Dec 23, 2025
867e06e
minor refactorings
daantimmer Dec 23, 2025
0715a6e
remove unused files
daantimmer Dec 23, 2025
2d07945
fixed co-pilot comments
daantimmer Dec 24, 2025
03832cd
fix bats-acceptance tests
daantimmer Dec 24, 2025
c9994f4
minor updates
daantimmer Dec 25, 2025
ef2d0c1
add summary formatter to debug launch configurations
daantimmer Dec 25, 2025
3dbb76e
add summary formatter to test.bats
daantimmer Dec 25, 2025
efe611e
query is now also a broadcaster for events
daantimmer Dec 25, 2025
a0f27cc
moved to new api::Formatters to register/enable formatters
daantimmer Dec 25, 2025
da2fcfb
remove unused eventDataCollector member from PrettyPrinter
daantimmer Jan 5, 2026
88e3a93
refactor: simplify title formatting in PrettyPrinter
daantimmer Jan 5, 2026
ee24b6f
refactor: update message formatting in FormatMessage function
daantimmer Jan 5, 2026
f3f2b9f
refactor: enhance error message in BuildArguments for better clarity
daantimmer Jan 5, 2026
2c52a4a
refactor: streamline hook assembly in AssembleTestSteps for improved …
daantimmer Jan 5, 2026
4782695
refactor: update test script and application files to improve formatt…
daantimmer Jan 5, 2026
ef11c11
refactor: enhance tests for TreeRegexp to clarify limitations of std:…
daantimmer Jan 6, 2026
c1d2a0b
refactor: rename ExtractStep to ExtractSteps for clarity and consistency
daantimmer Jan 6, 2026
0ff58a4
refactor: rename FormatMessage to FormatTestFailureMessage for clarity
daantimmer Jan 6, 2026
aa57ace
chore: update SonarQube scan action to version 7.0.0
daantimmer Jan 6, 2026
1eaefa6
refactor: add debug output steps to static analysis workflow for bett…
daantimmer Jan 6, 2026
7231def
refactor: update static analysis workflow to include exit codes for d…
daantimmer Jan 6, 2026
5f59bca
refactor: update static analysis workflow to use logical OR for exit …
daantimmer Jan 6, 2026
04b8aa4
refactor: update static analysis workflow to use 'true' for exit code…
daantimmer Jan 6, 2026
c23eabf
refactor: update test commands to use 'pretty' format for better outp…
daantimmer Jan 6, 2026
51fd45e
refactor: add coverage clean step and duplicate directory size checks…
daantimmer Jan 6, 2026
b9adf82
refactor: update test cases to correctly handle mandatory arguments a…
daantimmer Jan 6, 2026
794c541
refactor: remove tee command from bats task to simplify output handling
daantimmer Jan 6, 2026
8c18af3
refactor: remove unnecessary trailing commas in launch.json arguments
daantimmer Jan 6, 2026
5879949
refactor: replace strong ordering operators with SourceLocationOrder …
daantimmer Jan 6, 2026
5fd1def
refactor: simplify character class and group handling in regex parsing
daantimmer Jan 6, 2026
0e1a68b
refactor: use EXIT_SUCCESS and EXIT_FAILURE for exit codes in GetExit…
daantimmer Jan 6, 2026
3819881
refactor: move operator+ overloads for Lineage into the class definit…
daantimmer Jan 6, 2026
86b0bad
refactor: update SonarQube issue ignore rules to include additional c…
daantimmer Jan 6, 2026
f1e4d65
refactor: remove unnecessary blank line at the end of Parameter.cpp
daantimmer Jan 6, 2026
60af5a5
refactor: use default comparator for orderingMap in Application.cpp
daantimmer Jan 6, 2026
4b546b1
refactor: update launch arguments to use --tags instead of --tag
daantimmer Jan 6, 2026
6e50738
refactor: update formatter registration to use nlohmann::json for for…
daantimmer Jan 6, 2026
c82fa49
refactor: introduce FormatterOption struct for improved formatter han…
daantimmer Jan 7, 2026
b2155bf
refactor: enhance compatibility handling and streamline step registra…
daantimmer Jan 7, 2026
f91df55
refactor: simplify LoadDevkit function and improve path handling
daantimmer Jan 7, 2026
2e421e5
refactor: mark FormatterOption constructor as explicit
daantimmer Jan 7, 2026
6338f25
refactor: implement group parsing logic in TreeRegexp and enhance str…
daantimmer Jan 7, 2026
8e6e1f4
refactor: move ParameterRegistration instance to header for better vi…
daantimmer Jan 8, 2026
ccb2404
refactor: replace emplace with try_emplace for custom output file han…
daantimmer Jan 8, 2026
cffd389
refactor: remove unused includes from Body.cpp
daantimmer Jan 8, 2026
8c8dc9d
refactor: simplify event listener management and enhance parameter em…
daantimmer Jan 8, 2026
c8a25e4
refactor: improve AssembleSteps function signature and optimize assem…
daantimmer Jan 8, 2026
a47f823
refactor: optimize Argument constructor by using std::move for group …
daantimmer Jan 8, 2026
4902aaa
refactor: implement custom signal handler for SIGABRT
daantimmer Jan 8, 2026
3a7dac9
refactor: update CMakeLists to use consistent library naming and impr…
daantimmer Jan 8, 2026
e6c718b
refactor: replace ConverterTypeMap with support::ConverterTypeMap and…
daantimmer Jan 8, 2026
c46a929
refactor: remove unused GTest dependencies and clean up CMakeLists files
daantimmer Jan 8, 2026
f65ebd1
refactor: remove GTest dependencies and clean up RunCucumber implemen…
daantimmer Jan 8, 2026
f95d924
refactor: remove Parameter class and update related implementations t…
daantimmer Jan 9, 2026
bb8ceed
refactor: remove unused Body include from Worker.cpp
daantimmer Jan 9, 2026
4ac0d91
movesupport code to the support library
daantimmer Jan 9, 2026
b77cf83
refactor: enable test subdirectory and add dummy test implementation
daantimmer Jan 9, 2026
fe31842
refactor: remove unused includes from Token.hpp
daantimmer Jan 9, 2026
f5cfead
refactor: update parameter registration and step handling to use supp…
daantimmer Jan 9, 2026
7ab4c0e
Refactor Query and Formatter Integration
daantimmer Jan 9, 2026
3af273c
refactor: reorganize formatter library to use helper functions and im…
daantimmer Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 34 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,25 @@ jobs:
env:
SONAR_SERVER_URL: "https://sonarcloud.io"
steps:
- run: du -sh / || true
- run: du -sh . || true

- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0 # Disable shallow clone to enable blame information
persist-credentials: false

- run: du -sh / || true
- run: du -sh . || true

- uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
with:
key: ${{ github.job }}
max-size: 2G

- run: du -sh / || true
- run: du -sh . || true

- name: Build for coverage
uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
with:
Expand All @@ -42,28 +51,51 @@ jobs:
env:
GTEST_OUTPUT: "xml:${{ github.workspace }}/testresults/"

- run: du -sh / || true
- run: du -sh . || true

- name: Run acceptance tests
run: |
bats --formatter junit cucumber_cpp/acceptance_test/coverage.bats | tee test-report.xml
bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml

- run: du -sh / || true
- run: du -sh . || true

- name: Collect coverage
run: |
gcovr --sonarqube=coverage.xml --exclude-lines-by-pattern '.*assert\(.*\);|.*really_assert\(.*\);|.*std::abort();' --exclude-unreachable-branches --exclude-throw-branches -j "$(nproc)" --exclude=.*/example/.* --exclude=.*/external/.* --exclude=.*/test/.*

- run: du -sh / || true
- run: du -sh . || true

- uses: philips-software/sonarqube-issue-conversion@9e9958764ba5fd1d302b039779dc902bedfa4d01 # v1.2.0
with:
input: ${{ github.workspace }}/testresults/*.xml
output: execution.xml
transformation: gtest-to-generic-execution

- run: du -sh / || true
- run: du -sh . || true

- name: Convert results
run: |
cp .build/Coverage/compile_commands.json compile_commands.json

- uses: sonarsource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
- run: du -sh / || true
- run: du -sh . || true

- run: cmake --build --preset Coverage --target clean

- run: du -sh / || true
- run: du -sh . || true

- uses: sonarsource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- run: du -sh / || true
- run: du -sh . || true

codeql:
name: CodeQL
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
.xwin-cache
.vs/
megalinter-reports/

# compatibility generated files
actual.ndjson
expected.ndjson

# bats task generated files
test-report.xml
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ignore:
- external
- megalinter-reports
- testdata
- compatibility
63 changes: 50 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"@result:UNDEFINED",
"@result:FAILED",
"@result:OK",
"@fail_feature"
"@fail_feature",
"@ex:2",
"@substep",
"@table_argument",
"@thishasarule"
]
},
{
Expand All @@ -24,7 +28,10 @@
"type": "pickString",
"options": [
"cucumber_cpp/example/features",
"cucumber_cpp/acceptance_test/features"
"cucumber_cpp/example/features/rule.feature",
"cucumber_cpp/example/features/substep.feature",
"cucumber_cpp/acceptance_test/features",
"cucumber_cpp/devkit/empty/features"
]
}
],
Expand All @@ -35,17 +42,47 @@
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"run",
"--feature",
"${input:features}",
"--report",
"console",
"junit-xml",
// "--com",
// "COMx",
// "--nordic",
"--tag",
"${input:tag}"
"--com",
"COMx",
"--nordic",
"--format",
"summary",
"--tags",
"${input:tag}",
"--",
"${input:features}"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "ASAN_OPTIONS",
"value": "detect_leaks=0"
}
],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch - no tags",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"--com",
"COMx",
"--nordic",
"--format",
"summary",
"--",
"${input:features}"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cmake.useCMakePresets": "always",
"cucumberautocomplete.steps": [
"compatibility/*/*.cpp",
"cucumber_cpp/example/steps/*.cpp",
"cucumber_cpp/acceptance_test/steps/*.cpp"
],
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"label": "bats",
"type": "shell",
"command": "bats --formatter junit cucumber_cpp/acceptance_test/test.bats | tee test-report.xml",
"command": "bats --formatter junit cucumber_cpp/acceptance_test/test.bats",
"problemMatcher": []
}
]
Expand Down
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ endif()

if (CCR_STANDALONE)
set(CCR_DEFAULTOPT On)
else()
set(CCR_DEFAULTOPT Off)
endif()

if (CCR_STANDALONE)
set(CCR_EXCLUDE_FROM_ALL "")
else()
set(CCR_DEFAULTOPT Off)
set(CCR_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()

option(CCR_FETCH_DEPS "Fetch dependencies via FetchContent." On )
option(CCR_BUILD_TESTS "Enable build of the tests" ${CCR_DEFAULTOPT})
option(CCR_ENABLE_COVERAGE "Enable compiler flags for code coverage measurements" Off)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR CMAKE_CXX_SIMULATE_ID MATCHES "MSVC"))
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

if (CCR_BUILD_TESTS)
ccr_enable_testing()
endif()
Expand Down Expand Up @@ -68,3 +71,4 @@ else()
endif()

add_subdirectory(cucumber_cpp)
add_subdirectory(compatibility)
4 changes: 3 additions & 1 deletion CMakePresets.json

Choose a reason for hiding this comment

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

[MegaLinter] reported by reviewdog 🐶

"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "defaults",
"hidden": true,
"binaryDir": "${sourceDir}/.build/${presetName}",
"installDir": "${sourceDir}/.install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "On",
"CMAKE_CONFIGURATION_TYPES": "Debug;RelWithDebInfo;Release",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
}
},
{
"name": "Coverage",
"inherits": "defaults",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CCR_ENABLE_COVERAGE": "On"
}
},
{
"name": "Host",
"inherits": "defaults",
"generator": "Ninja Multi-Config"
},
{
"name": "host-single-Debug",
"displayName": "Configuration for Host Tooling and Tests, Single Config Generator, Debug",
"inherits": "defaults",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "Host-Iwyu",
"inherits": "defaults",
"cacheVariables": {
"CMAKE_CXX_INCLUDE_WHAT_YOU_USE": "include-what-you-use;-Wno-unknown-warning-option;-Xiwyu;--no_comments;-Xiwyu;--cxx17ns;-Xiwyu;--no_fwd_decls"
},
"generator": "Ninja Multi-Config"
},
{
"name": "Windows",
"inherits": "defaults",
"toolchainFile": "${sourceDir}/cmake/toolchain-clang-x86_64-pc-windows-msvc.cmake",
"environment": {
"CCACHE_DEPEND": "true",
"CCACHE_COMPILERTYPE": "clang-cl"
},
"generator": "Ninja Multi-Config"
}
],
"buildPresets": [
{
"name": "Coverage",
"configurePreset": "Coverage"
},
{
"name": "Host-Release",
"configuration": "Release",
"configurePreset": "Host"
},
{
"name": "Host-Debug",
"configuration": "Debug",
"configurePreset": "Host"
},
{
"name": "Host-Iwyu-Debug",
"configuration": "Debug",
"configurePreset": "Host-Iwyu"
},
{
"name": "host-single-Debug",
"configuration": "Debug",
"configurePreset": "host-single-Debug"
},
{
"name": "Windows-Release",
"configuration": "Release",
"configurePreset": "Windows"
},
{
"name": "Windows-RelWithDebInfo",
"configuration": "RelWithDebInfo",
"configurePreset": "Windows"
},
{
"name": "Windows-Debug",
"configuration": "Debug",
"configurePreset": "Windows"
}
],
"testPresets": [
{
"name": "defaults",
"hidden": true,
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
},
{
"name": "Coverage",
"configurePreset": "Coverage",
"configuration": "Debug",
"inherits": "defaults"
},
{
"name": "Host-Debug",
"configurePreset": "Host",
"configuration": "Debug",
"inherits": "defaults"
},
{
"name": "Host-Release",
"configurePreset": "Host",
"configuration": "Release",
"inherits": "defaults"
},
{
"name": "host-single-Debug",
"configurePreset": "host-single-Debug",
"configuration": "Debug",
"inherits": "defaults"
}
]

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"installDir": "${sourceDir}/.install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "On",
"CMAKE_CONFIGURATION_TYPES": "Debug;RelWithDebInfo;Release"
"CMAKE_CONFIGURATION_TYPES": "Debug;RelWithDebInfo;Release",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
}
},
{
Expand Down
48 changes: 48 additions & 0 deletions compatibility/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
function(add_compatibility_kit name)
set(libname compatibility.${name}.test)
add_executable(${libname})

if(CCR_BUILD_TESTS)
add_test(NAME ${libname} COMMAND ${libname})
endif()

target_link_libraries(${libname} PRIVATE
cucumber_cpp
gtest_main
)

target_include_directories(${libname} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

target_sources(${libname} PRIVATE
compatibility.cpp
)


if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${name}/${name}.cpp)
target_sources(${libname} PRIVATE
${name}/${name}.cpp
)
else()
set(SKIP_TEST On)
endif()

string(REPLACE "-" "_" KITNAME ${name})

target_compile_definitions(${libname} PRIVATE
KIT_NAME=${KITNAME}
KIT_STRING="${name}"
KIT_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}/${name}"
KIT_NDJSON_FILE="${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.ndjson"
$<$<BOOL:${SKIP_TEST}>:SKIP_TEST>
)
endfunction()

file(GLOB kits RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*)
foreach(kit ${kits})
if (IS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/${kit})
message(STATUS "Adding compatibility kit: ${kit}")
add_compatibility_kit(${kit})
endif()
endforeach()
12 changes: 12 additions & 0 deletions compatibility/ambiguous/ambiguous.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "cucumber_cpp/CucumberCpp.hpp"
#include <string>

STEP(R"(^a (.*?) with (.*?)$)", (const std::string& arg1, const std::string& arg2))
{
// no-op
}

STEP(R"(^a step with (.*?)$)", (const std::string& arg1))
{
// no-op
}
6 changes: 6 additions & 0 deletions compatibility/ambiguous/ambiguous.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Ambiguous steps
Multiple step definitions that match a pickle step result in an AMBIGUOUS status, since Cucumnber cannot determine
which one to execute.

Scenario: Multiple step definitions for a step
Given a step with multiple definitions
13 changes: 13 additions & 0 deletions compatibility/ambiguous/ambiguous.ndjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{"meta":{"protocolVersion":"31.0.0","implementation":{"name":"fake-cucumber","version":"123.45.6"},"cpu":{"name":"arm64"},"os":{"name":"darwin","version":"24.5.0"},"runtime":{"name":"Node.js","version":"24.4.1"},"ci":{"name":"GitHub Actions","url":"https://github.com/cucumber-ltd/shouty.rb/actions/runs/154666429","buildNumber":"154666429","git":{"revision":"99684bcacf01d95875834d87903dcb072306c9ad","remote":"https://github.com/cucumber-ltd/shouty.rb.git","branch":"main"}}}}
{"source":{"data":"Feature: Ambiguous steps\n Multiple step definitions that match a pickle step result in an AMBIGUOUS status, since Cucumnber cannot determine\n which one to execute.\n\n Scenario: Multiple step definitions for a step\n Given a step with multiple definitions\n","uri":"samples/ambiguous/ambiguous.feature","mediaType":"text/x.cucumber.gherkin+plain"}}
{"gherkinDocument":{"feature":{"tags":[],"location":{"line":1,"column":1},"language":"en","keyword":"Feature","name":"Ambiguous steps","description":" Multiple step definitions that match a pickle step result in an AMBIGUOUS status, since Cucumnber cannot determine\n which one to execute.","children":[{"scenario":{"id":"1","tags":[],"location":{"line":5,"column":3},"keyword":"Scenario","name":"Multiple step definitions for a step","description":"","steps":[{"id":"0","location":{"line":6,"column":5},"keyword":"Given ","keywordType":"Context","text":"a step with multiple definitions"}],"examples":[]}}]},"comments":[],"uri":"samples/ambiguous/ambiguous.feature"}}
{"pickle":{"id":"3","uri":"samples/ambiguous/ambiguous.feature","location":{"line":5,"column":3},"astNodeIds":["1"],"tags":[],"name":"Multiple step definitions for a step","language":"en","steps":[{"id":"2","text":"a step with multiple definitions","type":"Context","astNodeIds":["0"]}]}}
{"stepDefinition":{"id":"4","pattern":{"type":"REGULAR_EXPRESSION","source":"^a (.*?) with (.*?)$"},"sourceReference":{"uri":"samples/ambiguous/ambiguous.ts","location":{"line":3}}}}
{"stepDefinition":{"id":"5","pattern":{"type":"REGULAR_EXPRESSION","source":"^a step with (.*?)$"},"sourceReference":{"uri":"samples/ambiguous/ambiguous.ts","location":{"line":7}}}}
{"testRunStarted":{"id":"6","timestamp":{"seconds":0,"nanos":0}}}
{"testCase":{"id":"7","pickleId":"3","testSteps":[{"id":"8","pickleStepId":"2","stepDefinitionIds":["4","5"],"stepMatchArgumentsLists":[{"stepMatchArguments":[{"group":{"start":2,"value":"step","children":[]}},{"group":{"start":12,"value":"multiple definitions","children":[]}}]},{"stepMatchArguments":[{"group":{"start":12,"value":"multiple definitions","children":[]}}]}]}],"testRunStartedId":"6"}}
{"testCaseStarted":{"id":"9","testCaseId":"7","timestamp":{"seconds":0,"nanos":1000000},"attempt":0}}
{"testStepStarted":{"testCaseStartedId":"9","testStepId":"8","timestamp":{"seconds":0,"nanos":2000000}}}
{"testStepFinished":{"testCaseStartedId":"9","testStepId":"8","testStepResult":{"status":"AMBIGUOUS","duration":{"seconds":0,"nanos":0}},"timestamp":{"seconds":0,"nanos":3000000}}}
{"testCaseFinished":{"testCaseStartedId":"9","timestamp":{"seconds":0,"nanos":4000000},"willBeRetried":false}}
{"testRunFinished":{"testRunStartedId":"6","timestamp":{"seconds":0,"nanos":5000000},"success":false}}
9 changes: 9 additions & 0 deletions compatibility/ambiguous/ambiguous.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Given } from '@cucumber/fake-cucumber'

Given(/^a (.*?) with (.*?)$/, function () {
// first one
})

Given(/^a step with (.*)$/, function () {
// second one
})
54 changes: 54 additions & 0 deletions compatibility/attachments/attachments.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "cucumber_cpp/CucumberCpp.hpp"
#include "cucumber_cpp/library/engine/ExecutionContext.hpp"
#include <cstdint>
#include <filesystem>
#include <fstream>
#include <ios>
#include <numeric>
#include <source_location>
#include <sstream>
#include <string>

namespace
{
const std::filesystem::path currentCompileDir = std::filesystem::path{ std::source_location::current().file_name() }.parent_path();
}

WHEN(R"(the string {string} is attached as {string})", (const std::string& text, const std::string& mediaType))
{
Attach(text, mediaType);
}

WHEN(R"(the string {string} is logged)", (const std::string& text))
{
Log(text);
}

WHEN(R"(text with ANSI escapes is logged)")
{
Log("This displays a \x1b[31mr\x1b[0m\x1b[91ma\x1b[0m\x1b[33mi\x1b[0m\x1b[32mn\x1b[0m\x1b[34mb\x1b[0m\x1b[95mo\x1b[0m\x1b[35mw\x1b[0m");
}

WHEN(R"(the following string is attached as {string}:)", (const std::string& mediaType))
{
Attach(docString->content, mediaType);
}

WHEN(R"(an array with {int} bytes is attached as {string})", (std::int32_t size, const std::string& mediaType))
{
std::string data(size, '\0');
std::iota(data.begin(), data.end(), 0);
std::stringstream stream{ data };
Attach(stream, mediaType);
}

WHEN(R"(a PDF document is attached and renamed)")
{
std::ifstream pdfFile{ currentCompileDir / "document.pdf", std::ios::binary };
Attach(pdfFile, cucumber_cpp::library::engine::AttachOptions{ "application/pdf", "renamed.pdf" });
}

WHEN(R"(a link to {string} is attached)", (const std::string& url))
{
Link(url);
}
Loading
Loading