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

Extend support for Equal in trusted func framework #75

Merged
merged 6 commits into from
Oct 17, 2023

Conversation

sonalmahajan15
Copy link
Contributor

Equal support was limited to only handling slice length comparison (e.g., Equal(0, len(s))). This PR extends this Equal support also handle nil comparisons (e.g., Equal(nil, err)). Specifically, this PR makes the following changes:

  • Refactors existing requireComparators code to accommodate the extension
  • Add support for nil comparison in requireComparators
  • Adds test cases for nil comparison
  • Adds NotEqual in trusted funcs list and specific test cases for the slice comparison case as well

[Closes #64 ]

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #75 (9a5bbf7) into main (9ab92c9) will increase coverage by 0.09%.
The diff coverage is 86.66%.

@@            Coverage Diff             @@
##             main      #75      +/-   ##
==========================================
+ Coverage   89.23%   89.32%   +0.09%     
==========================================
  Files          53       53              
  Lines        8016     8048      +32     
==========================================
+ Hits         7153     7189      +36     
+ Misses        716      712       -4     
  Partials      147      147              
Files Coverage Δ
assertion/function/assertiontree/trusted_func.go 74.33% <86.66%> (+7.87%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sonalmahajan15 sonalmahajan15 force-pushed the sonalmahajan15/fix-trusted-func-equal branch from 058ef01 to 90b5a42 Compare October 11, 2023 16:23
Copy link
Contributor

@yuxincs yuxincs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM module a few nits that do not necessarily have to be fixed 😃 .

assertion/function/assertiontree/trusted_func.go Outdated Show resolved Hide resolved
assertion/function/assertiontree/trusted_func.go Outdated Show resolved Hide resolved
assertion/function/assertiontree/trusted_func.go Outdated Show resolved Hide resolved
@sonalmahajan15 sonalmahajan15 force-pushed the sonalmahajan15/fix-trusted-func-equal branch from 588c61a to 9a5bbf7 Compare October 17, 2023 18:29
@sonalmahajan15 sonalmahajan15 merged commit 8695414 into main Oct 17, 2023
@sonalmahajan15 sonalmahajan15 deleted the sonalmahajan15/fix-trusted-func-equal branch October 17, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using testify's Equal() for error checking reports a false positive
2 participants