Skip to content

[BUG] A function variable with nil value cannot be asserted with BeNil() #171

@shafeeqes

Description

@shafeeqes

Describe the bug

I have a test:

		It("the test should pass", func() {
			fn := func(string) error { return nil }
			fn = nil

			Expect(fn).To(BeNil())
		})

This yields an error

ginkgo-linter: wrong error assertion. Consider using `Expect(fn).To(Succeed())` instead (ginkgolinter)
			Expect(fn).To(BeNil())

in the linter.
I agree Succeed() also matches nil values, but I would like BeNil() as it's more explicit.

To Reproduce
Steps to reproduce the behavior:

  1. first step

Expected behavior
BeNil to be possible to be used with nil function variables.

Environment:

  • OS: [darwin/arm64]
  • Version v0.18.0

Additional context
Probably introduced with #146

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions