-
Notifications
You must be signed in to change notification settings - Fork 773
pkg/syncmap: add unit test for GetAsAtomicInt #1216
pkg/syncmap: add unit test for GetAsAtomicInt #1216
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1216 +/- ##
==========================================
+ Coverage 47.78% 47.84% +0.06%
==========================================
Files 118 118
Lines 7436 7436
==========================================
+ Hits 3553 3558 +5
+ Misses 3596 3591 -5
Partials 287 287
Continue to review full report at Codecov.
|
mmap.Add("aaa", expected) | ||
|
||
result, _ := mmap.GetAsAtomicInt("aaa") | ||
c.Check(result, check.DeepEquals, expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add code here to check the non-existent one, then check the non-nil error:
result, err := mmap.GetAsAtomicInt("nonexist")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, PTAL
31003ca
to
f148faf
Compare
CI failed, PTAL:
|
|
||
result, err := mmap.GetAsAtomicInt("nonexist") | ||
c.Check(err, check.NotNil) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add c.Check(result, check.IsNil)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, thanks.
f148faf
to
11ce918
Compare
Signed-off-by: Zhou Hao <[email protected]>
LGTM |
Signed-off-by: Gaius <[email protected]>
Signed-off-by: Zhou Hao [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews