Skip to content

Add Doc string tests - #322

Open
mbraendli wants to merge 2 commits into
cucumber:mainfrom
mbraendli:doc-string-tests
Open

mbraendli wants to merge 2 commits into
cucumber:mainfrom
mbraendli:doc-string-tests

Conversation

@mbraendli

Copy link
Copy Markdown
Contributor

Summary

Add doc string tests and example to verify handling of multiline doc strings and ensure compatibility with Cucumber-Ruby. Analysis, implementation, and tests were realized with Claude Code. Manual tests and reviews were done for all changes.

Details

  • Added two wire protocol tests:
    • handlesInvokeMessageWithMultilineDocStringArg: Validates multiline doc strings with indentation and quotes.
    • passesDocStringArgToStepDefinition: Ensures doc strings are passed unchanged through WireProtocolHandler and CukeEngineImpl.
  • Added a doc string example in FeatureShowcase covering scenarios without/with content type and one after a regex parameter.
  • Note: Content type is not transmitted over the wire (consistent with cucumber-wire behavior).

Motivation and Context

The README currently warns about a bug in the wire protocol implementation (cucumber/cucumber-ruby#1183). While the underlying bug was fixed in Cucumber-Ruby 2.1.0, this repository lacked doc string coverage. This PR adds tests and examples to verify functionality. The README warning removal is handled separately in PR #320.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Additional tests

Checklist:

  • It is my own work, its copyright is implicitly assigned to the project and no substantial part of it has been copied from other sources (including Stack Overflow). In rare occasions this is acceptable, like in CMake modules where the original copyright information should be kept.
  • I'm using the same code standards as the existing code (indentation, spacing, variable naming, ...).
  • I've added tests for my code.
  • I have verified whether my change requires changes to the documentation
  • My change either requires no documentation change or I've updated the documentation accordingly.
  • My branch has been rebased to main, keeping only relevant commits.

Cucumber-Ruby 7.1 and 10 send a doc string as an additional string
argument in the invoke request, which the existing tests for string
arguments already cover. Add a test for a doc string that spans
multiple lines and contains indentation and quotes, and check that a
step definition receives such a doc string unchanged.

Assisted-by: Claude Code
Show how a step definition receives a doc string: as the last argument,
after the regex parameters. The steps check the received text exactly,
including line breaks and indentation, for a doc string without and
with content type and for one following a regex parameter. The content
type itself is not sent over the wire.

As the functional tests run this example, they also check that the doc
strings arrive unchanged over the wire.

Assisted-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant