Skip to content

Incorrect require.Error() docs  #1609

@andig

Description

@andig

Description

The error docs read:

// Error asserts that a function returned an error (i.e. not `nil`).
//
//	  actualObj, err := SomeFunction()
//	  if assert.Error(t, err) {
//		   assert.Equal(t, expectedError, err)
//	  }

This indicates that Error() has a bool return value which it hasn't. There is no way to check expectedError like this.

Expected behavior

Error docs should show actual usage. It would be nice if Error() actually allowed for checking the specific error value.

Metadata

Metadata

Assignees

Labels

bugpkg-requireChange related to package testify/require

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions