testify icon indicating copy to clipboard operation
testify copied to clipboard

Update documentation for the Error function in assert or require package

Open architagr opened this issue 1 year ago • 1 comments

Summary

Incorrect assert.Error() docs

Changes

Removing the if statement and the Equal call from the example.

Motivation

Since we already have EqualError, the documentation is trying to use assert.Equal to assert the error object's content.

Related issues

Closes #1609

architagr avatar Nov 02 '24 21:11 architagr

The change now hides that Error returns a boolean that can be used for further checks.

I think that we must keep the if statement around in the usage example.

This change is in accordance with the below conversation by @brackendawson

https://github.com/stretchr/testify/issues/1609#issuecomment-2402331089

architagr avatar Dec 15 '24 16:12 architagr

@architagr I'd like to get this merged but I can't in good faith dismiss @dolmen's review because this PR still removes the last reference to assert's functions returning a bool. Can you add a paragraph to assert/doc.go which explains that all assertions return a bool indicating if the assertion passed? Then I think we can merge this change.

brackendawson avatar Mar 22 '25 22:03 brackendawson

@architagr I'd like to get this merged but I can't in good faith dismiss @dolmen's review because this PR still removes the last reference to assert's functions returning a bool. Can you add a paragraph to assert/doc.go which explains that all assertions return a bool indicating if the assertion passed? Then I think we can merge this change.

Sure I can do that

architagr avatar Mar 25 '25 18:03 architagr

@architagr I'd like to get this merged but I can't in good faith dismiss @dolmen's review because this PR still removes the last reference to assert's functions returning a bool. Can you add a paragraph to assert/doc.go which explains that all assertions return a bool indicating if the assertion passed? Then I think we can merge this change.

Hi @brackendawson, I have updated the doc.go, can you please have a look if that looks ok.

architagr avatar Apr 22 '25 18:04 architagr