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

panic in pretty printing, when background step is longer than scenario step #42

Closed
nightlyone opened this issue Jun 22, 2016 · 0 comments

Comments

@nightlyone
Copy link
Contributor

given

Feature:
Background:
Given very long string here we cannot imagine how long

Scenario:
Given short

leads to panic in pretty printer.

The following patch fixes it for me:

--- a/fmt_pretty.go
+++ b/fmt_pretty.go
@@ -256,6 +256,9 @@ func (f *pretty) printStepKind(res *stepResult) {
        // first step of scenario, print header and calculate comment position
        case f.scenario != nil && f.steps == len(f.scenario.Steps):
                f.commentPos = f.longestStep(f.scenario.Steps, f.length(f.scenario))
+               if bgLength := f.longestStep(f.feature.Background.Steps, f.length(f.feature.Background)); bgLength > f.commentPos {
+                       f.commentPos = bgLength
+               }
                text := s(f.indent) + bcl(f.scenario.Keyword+": ", white) + f.scenario.Name
                text += s(f.commentPos-f.length(f.scenario)+1) + f.line(f.scenario.Location)
                fmt.Println("\n" + text)
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

No branches or pull requests

1 participant