The Wayback Machine - https://web.archive.org/web/20200827215328/https://github.com/stretchr/testify/issues/711
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

doc: not clear how to test for one number less than another #711

Open
shaunc opened this issue Dec 30, 2018 · 3 comments
Open

doc: not clear how to test for one number less than another #711

shaunc opened this issue Dec 30, 2018 · 3 comments

Comments

@shaunc
Copy link

@shaunc shaunc commented Dec 30, 2018

I assume I want to use Comparison somehow, but the documentation is quite unclear. What I want is (equivalent to):

  assert.LessThan(t, 3, 4). // passes
  assert.LessThan(t, 4, 3). // fails
@ollien
Copy link

@ollien ollien commented Mar 16, 2019

For those who find this when googling (like I was), while master does include assertions for this, it is not present in the current release (1.3.0). The documentation reflects master, rather than the current release.

If you want to do this in the current release, you can do something like this

// Cannot call this more times than we have values for
assert.True(t, func() bool {
	return readCursor < len(pasteContents)
}())
@kandros
Copy link

@kandros kandros commented May 18, 2019

You can use assert.Less

	assert.Less(t, 3, 4) // passes
	assert.Less(t, 4, 3) // fails

doc here

@ollien
Copy link

@ollien ollien commented May 18, 2019

@kandros This is not present in the current release, only in master.

@mvdkleijn mvdkleijn added this to To do in Documentation Aug 12, 2020
@mvdkleijn mvdkleijn moved this from To do to Backlog in Documentation Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.