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

Please, think about additional assert types #14

Open
ghost opened this issue Jul 14, 2022 · 5 comments
Open

Please, think about additional assert types #14

ghost opened this issue Jul 14, 2022 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ghost
Copy link

ghost commented Jul 14, 2022

Currently we have next asserts:

  • Contains
  • Equal
  • NotEqual
  • Length
  • GreaterThan
  • LessThan
  • Present
  • NotPresent

Please, think to add next assert types:

  • GreaterEqual
  • LessEqual
  • AssertArray
@siller174 siller174 added enhancement New feature or request good first issue Good for newcomers labels Jul 15, 2022
@shalimski
Copy link
Contributor

It seems that if you add GreaterOrEqualThan then GreaterThan behaviour becomes wrong, it doesn't return an error on Equal case. Also LessOrEqualThen.
I could add these features, but then I'd have to break backwards compatibility, right?

@siller174
Copy link
Collaborator

So, now GreaterThani is assert only for array. It's my mistake. I think. if we add comparing(equal) for numbers with error on zero case, it will be ok

@shalimski
Copy link
Contributor

I didn't see how that would help.
Here is an example of what I was talking about:

assert.Greater(t, 3, 3)                                // testify FAIL "3" is not greater than "3"
GreaterThan("$.o", 3)([]byte(`{"o":["a", "b", "c"]}`)) // ok

So, If you add GreaterOrEqualThan, behaviour of GreaterThan should change to FAIL

@siller174
Copy link
Collaborator

Sorry for long answer.
My point is need to copy logic assertion from assert package and implement it. If it will break backwards compatibility, it's ok.

siller174 added a commit that referenced this issue Sep 14, 2022
@siller174
Copy link
Collaborator

Thank you @shalimski for #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants