Closed ccoVeille closed 5 months ago
I could iterate and make the commit atomic, so it won't be a block like this.
I created a isZeroValue separated from isZero to avoid conflicting with code that is already using isZero or isIntNumber
Tell me what you think about it @Antonboom
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 13 | 16 | 81.25% | ||
<!-- | Total: | 17 | 20 | 85.0% | --> |
Totals | |
---|---|
Change from base Build 9525746925: | -0.09% |
Covered Lines: | 2123 |
Relevant Lines: | 2270 |
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 13 | 16 | 81.25% | ||
<!-- | Total: | 17 | 20 | 85.0% | --> |
Totals | |
---|---|
Change from base Build 9525746925: | -0.09% |
Covered Lines: | 2123 |
Relevant Lines: | 2270 |
I made the changes. Let me know if you are fine with them
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 16 | 19 | 84.21% | ||
<!-- | Total: | 28 | 31 | 90.32% | --> |
Totals | |
---|---|
Change from base Build 9569376633: | -0.08% |
Covered Lines: | 2125 |
Relevant Lines: | 2272 |
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 32 | 34 | 94.12% | ||
<!-- | Total: | 44 | 46 | 95.65% | --> |
Totals | |
---|---|
Change from base Build 9569376633: | 0.06% |
Covered Lines: | 2130 |
Relevant Lines: | 2274 |
Thanks for the test refactoring.
Also the changes to generate and test one checker without the others 🥰
~I don't get the point of removing the unsigned int? I'm OK with it, but I'm unsure why.~
Edited: I found the reply here https://github.com/Antonboom/testifylint/pull/126#discussion_r1645601601
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 32 | 34 | 94.12% | ||
<!-- | Total: | 44 | 46 | 95.65% | --> |
Totals | |
---|---|
Change from base Build 9569376633: | 0.06% |
Covered Lines: | 2130 |
Relevant Lines: | 2274 |
@ccoVeille read the comments above 👆
I'm OK with the changes, you removed the uint vs negative, which is obvious
For records, I found examples of code where uint is used in something that should be converted to Positive
https://github.com/search?q=language%3Ago+%22assert.Less%28t%2C+uint%22&type=code https://github.com/search?q=language%3Ago+%22assert.Greater%28t%2C+uint%22&type=code
assert.Less(t, uint64(0), e.VideoMinutes)
assert.Less(t, uint32(0), c.stats.Rto)
assert.Less(t, uint32(0), c.stats.Ato)
assert.Less(t, uint64(0), baseLineHeap)
assert.Greater(t, uint64(result.GasUsed), minGasExpected)
assert.Greater(t, uint64(state.LastUpdatedEpoch), uint64(0))
These are edge cases, but they are legitimate according to me.
But we could move them to a separate issue, and current PR could be merged like this.
There is also something that is left aside
assert.True(t, uint64(0) < prod["last_claim_time"].(uint64))
Some other can be found with such query https://github.com/search?q=language%3Ago+%22assert.True%28t%2C+uint%22&type=code
But here we could say it's open for debate, should we consider suggesting:
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 32 | 34 | 94.12% | ||
<!-- | Total: | 44 | 46 | 95.65% | --> |
Totals | |
---|---|
Change from base Build 9569376633: | 0.06% |
Covered Lines: | 2130 |
Relevant Lines: | 2274 |
@ccoVeille
But, unsigned int can be positive, so they leads to compare they are not zero/empty.
this is just my mistake.
I returned back uint
support for assert.Positive
and added real-life examples to tests
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
internal/checkers/helpers_basic_type.go | 51 | 53 | 96.23% | ||
<!-- | Total: | 71 | 73 | 97.26% | --> |
Totals | |
---|---|
Change from base Build 9569376633: | 0.1% |
Covered Lines: | 2149 |
Relevant Lines: | 2293 |
@ccoVeille
But, unsigned int can be positive, so they leads to compare they are not zero/empty.
this is just my mistake. I returned back
uint
support forassert.Positive
and added real-life examples to tests
I think we are good
Fixes #94