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

Issue-14: replace outline variables in docstrings #16

Merged
merged 2 commits into from
Mar 27, 2015
Merged

Conversation

ppeble
Copy link
Contributor

@ppeble ppeble commented Mar 26, 2015

No description provided.

@ppeble
Copy link
Contributor Author

ppeble commented Mar 26, 2015

I will be going over the 'multiple examples' problem separately (assuming that I am correct that it is an actual problem).

var called bool
steps.Given("something is:", func(_ []string, step StepNode) {
called = true
assert.Equal(t, "minimally functional\n\n", step.PyString().String())
Copy link
Contributor

Choose a reason for hiding this comment

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

Two newlines is incorrect. If one comes from the initial parsing1, I'm fine with leaving it. Adding any is definitely not good.

1 Gherkin tests show the final newline being omitted, but that should be done over in go-gherkin, I think.
https://github.com/cucumber/gherkin3/blob/master/testdata/good/docstrings.feature.ast#L12-L16
https://github.com/cucumber/gherkin3/blob/master/testdata/good/docstrings.feature.ast.json#L38

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has to do with how go-gherkin prints out the lines via the String() function: https://github.com/muhqu/go-gherkin/blob/e07b6f9917cc9d90dd0a5d5f9ab9a63c82efe045/nodes/nodes.go#L463-L469

In reality what is stored in with the single \n. It's only when we print it in the test that is shows up with two \n's.

I'm at a bit of a loss. It seems like when we execute the step we will have the correct single \n character. I could resolve this like so:

pyString.AddLine(replace(strings.Trim(original.PyString().String(), "\n")))

But wouldn't I be removing the newline that will be present in the steps?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I didn't realize that PyStringNode stored separate lines. We need to keep doing that, so I guess iterate Lines() and AddLine(replace(line)) many times.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the assertion should change to Lines() as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 835b954

@ppeble
Copy link
Contributor Author

ppeble commented Mar 27, 2015

Failing build! Whattttttt

@ppeble
Copy link
Contributor Author

ppeble commented Mar 27, 2015

Oh, just a temporary connection issue.

@cbandy
Copy link
Contributor

cbandy commented Mar 27, 2015

👍

ppeble added a commit that referenced this pull request Mar 27, 2015
Issue-14: replace outline variables in docstrings
@ppeble ppeble merged commit 7e2669e into master Mar 27, 2015
@ppeble ppeble deleted the issue-14 branch March 27, 2015 19:10
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.

2 participants