Skip to content
New issue

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

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

Already on GitHub? # to your account

Commenting out features causes nil pointer dereference #286

Closed
jamescooke opened this issue Apr 29, 2020 · 1 comment
Closed

Commenting out features causes nil pointer dereference #286

jamescooke opened this issue Apr 29, 2020 · 1 comment
Assignees
Labels
🐛 bug Defect / Bug

Comments

@jamescooke
Copy link

jamescooke commented Apr 29, 2020

Please answer these questions before submitting a bug report.

What version of godog are you using?

> godog -version
Godog version is: v0.9.0

Fails with both go get of v0.9.0 and master.

What version of Go are you using?

> go version
go version go1.14.2 linux/amd64

What did you do?

Comment out all features in a feature file:

# Feature: list Items
# 
#   API clients can do `GET /items` to retrieve a list of Items.
# 
#   Scenario: Items are empty
#     When API client requests list of Items
#     Then response status is 200
#     And response contains an empty list of Items

What did you expect to see?

Either a warning that no feature was found, or silently skip. Godog should execute the other features in other feature files that are not commented out.

What did you see instead?

Run godog and get a stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x8f0fff]

goroutine 1 [running]:
github.com/cucumber/godog.(*pretty).printFeature(0xc000010268, 0x0)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/fmt_pretty.go:75 +0x4f
github.com/cucumber/godog.(*pretty).Feature(0xc000010268, 0xc00012d740, 0xc00002a780, 0x1c, 0xc00014a000, 0x178, 0x178)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/fmt_pretty.go:32 +0x8a
github.com/cucumber/godog.(*Suite).runFeature(0xc00014f680, 0xc0000c6880)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/suite.go:543 +0xca
github.com/cucumber/godog.(*Suite).run(0xc00014f680)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/suite.go:339 +0xaf
github.com/cucumber/godog.(*runner).run(0xc000119f80, 0x14)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/run.go:118 +0xae
github.com/cucumber/godog.RunWithOptions(0x9ff1c6, 0x5, 0xc00010d740, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9ffa17, 0x6, ...)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/run.go:215 +0x99c
github.com/cucumber/godog.Run(0x9cea07, 0xb, 0x9f1a58, 0xc000072058)
        /home/vagrant/go/pkg/mod/github.com/cucumber/godog@v0.9.0/run.go:270 +0x265
main.main()
        /tmp/go-build814842378/b001/_testmain.go:14 +0x42
@jamescooke jamescooke added the 🐛 bug Defect / Bug label Apr 29, 2020
@mxygem
Copy link
Member

mxygem commented Apr 29, 2020

Woah, that's certainly not desired. Thanks for pointing this out @jamescooke !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🐛 bug Defect / Bug
Projects
None yet
Development

No branches or pull requests

3 participants