Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gherkin-perl] Implement Gherkin on top of Cucumber::Messages #1735

Merged
merged 5 commits into from
Sep 8, 2021

Conversation

ehuelsmann
Copy link
Contributor

@ehuelsmann ehuelsmann commented Sep 7, 2021

Summary

Change the Gherkin implementation to use real Cucumber::Messages instead of hashes that look like them.

Details

Since Gherkin existed since way before Cucumber::Messages, its prior implementations didn't build upon them. With the recent implementation and release of Cucumber::Messages for Perl, now is the time to move the implementation over from the surrogates to the real thing.

Motivation and Context

With this change, the Perl implementation of Gherkin moves closer to its equivalents in other languages.

How Has This Been Tested?

The conformance tests.

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).

Checklist:

  • The change has been ported to Java.
  • The change has been ported to Ruby.
  • The change has been ported to JavaScript.
  • The change has been ported to Go.
  • The change has been ported to .NET.
  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the CHANGELOG accordingly.

Increase the minimum supported Perl version to 5.14 (release date
May 14, 2011) because that's the minimum supported by Cucumber::Messages.
…ckles

In Gherkin, the AstBuilder and the Pickle compiler, instantiate Cucumber::Messages
when constructing return values (the source, gherkin document and pickles, respectively).

Note that the earlier implementation used hashes (instead of object instances); the new
implementation uses methods to access slot values whereas the old implementation used
hash element access (`$table_row->{'cells'}` is therefore replaced by `$table_row->cells`).

Additionally, adjust the consumer (App::gherkin) to consume Cucumber::Message envelopes
instead of hashes: messages "know" how to serialize themselves to JSON (meaning that the
consumer won't need to cater for its own serialization).
@ehuelsmann ehuelsmann marked this pull request as ready for review September 7, 2021 21:35
Copy link
Contributor

@aurelien-reeves aurelien-reeves left a comment

Choose a reason for hiding this comment

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

As far as I can tell, it looks good 👌

@ehuelsmann
Copy link
Contributor Author

@aurelien-reeves Thanks for the review! Merging.

@ehuelsmann ehuelsmann merged commit 8458315 into main Sep 8, 2021
@ehuelsmann ehuelsmann deleted the update-gherkin-perl branch September 8, 2021 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants