Skip to content

Commit

Permalink
Fixes #604 - remove line overwriting for scenario outlines in cucumbe…
Browse files Browse the repository at this point in the history
…r formatter (#605)
  • Loading branch information
glibas committed Jan 31, 2024
1 parent 5a5631a commit 250d69a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org).
This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).

## Unreleased

### Fixed
- Remove line overwriting for scenario outlines in cucumber formatter ([605](https://github.com/cucumber/godog/pull/605) - [glibas](https://github.com/glibas))

## [v0.13.0]
### Added
- Support for reading feature files from an `fs.FS` ([550](https://github.com/cucumber/godog/pull/550) - [tigh-latte](https://github.com/tigh-latte))
Expand Down
4 changes: 2 additions & 2 deletions features/formatter/cucumber.feature
Expand Up @@ -323,7 +323,7 @@ Feature: cucumber json formatter
{
"keyword": "Given ",
"name": "passing step",
"line": 11,
"line": 7,
"match": {
"location": "suite_context.go:64"
},
Expand All @@ -345,7 +345,7 @@ Feature: cucumber json formatter
{
"keyword": "Given ",
"name": "failing step",
"line": 12,
"line": 7,
"match": {
"location": "suite_context.go:47"
},
Expand Down
4 changes: 0 additions & 4 deletions internal/formatters/fmt_cucumber.go
Expand Up @@ -252,10 +252,6 @@ func (f *Cuke) buildCukeStep(pickle *messages.Pickle, stepResult models.PickleSt
step := feature.FindStep(pickleStep.AstNodeIds[0])

line := step.Location.Line
if len(pickle.AstNodeIds) == 2 {
_, row := feature.FindExample(pickle.AstNodeIds[1])
line = row.Location.Line
}

cukeStep.Name = pickleStep.Text
cukeStep.Line = int(line)
Expand Down
30 changes: 15 additions & 15 deletions internal/formatters/formatter-tests/cucumber/scenario_outline
Expand Up @@ -46,7 +46,7 @@
{
"keyword": "Given ",
"name": "passing step",
"line": 13,
"line": 6,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -58,7 +58,7 @@
{
"keyword": "When ",
"name": "passing step",
"line": 13,
"line": 7,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -70,7 +70,7 @@
{
"keyword": "Then ",
"name": "odd 1 and even 2 number",
"line": 13,
"line": 8,
"match": {
"location": "fmt_output_test.go:103"
},
Expand Down Expand Up @@ -110,7 +110,7 @@
{
"keyword": "Given ",
"name": "passing step",
"line": 14,
"line": 6,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -122,7 +122,7 @@
{
"keyword": "When ",
"name": "passing step",
"line": 14,
"line": 7,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -134,7 +134,7 @@
{
"keyword": "Then ",
"name": "odd 2 and even 0 number",
"line": 14,
"line": 8,
"match": {
"location": "fmt_output_test.go:103"
},
Expand Down Expand Up @@ -175,7 +175,7 @@
{
"keyword": "Given ",
"name": "passing step",
"line": 15,
"line": 6,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -187,7 +187,7 @@
{
"keyword": "When ",
"name": "passing step",
"line": 15,
"line": 7,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -199,7 +199,7 @@
{
"keyword": "Then ",
"name": "odd 3 and even 11 number",
"line": 15,
"line": 8,
"match": {
"location": "fmt_output_test.go:103"
},
Expand Down Expand Up @@ -240,7 +240,7 @@
{
"keyword": "Given ",
"name": "passing step",
"line": 20,
"line": 6,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -252,7 +252,7 @@
{
"keyword": "When ",
"name": "passing step",
"line": 20,
"line": 7,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -264,7 +264,7 @@
{
"keyword": "Then ",
"name": "odd 1 and even 14 number",
"line": 20,
"line": 8,
"match": {
"location": "fmt_output_test.go:103"
},
Expand Down Expand Up @@ -304,7 +304,7 @@
{
"keyword": "Given ",
"name": "passing step",
"line": 21,
"line": 6,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -316,7 +316,7 @@
{
"keyword": "When ",
"name": "passing step",
"line": 21,
"line": 7,
"match": {
"location": "fmt_output_test.go:101"
},
Expand All @@ -328,7 +328,7 @@
{
"keyword": "Then ",
"name": "odd 3 and even 9 number",
"line": 21,
"line": 8,
"match": {
"location": "fmt_output_test.go:103"
},
Expand Down

0 comments on commit 250d69a

Please sign in to comment.