-
Notifications
You must be signed in to change notification settings - Fork 0
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
Test com.Cond #46
base: main
Are you sure you want to change the base?
Test com.Cond #46
Conversation
case <-done: | ||
require.Fail(t, "cond should still not be closed") | ||
case <-cond.Done(): | ||
require.Fail(t, "cond should not be closed for round 2, yet") |
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.
Is there a difference between those two cases? Both cases check the value of cond.Done()
, returning cond.done
which doesn't change over the time. Unless I'm missing something, this is the exact same channel.
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.
What you digged out is an implementation detail which tests don't rely on.
done := cond.Done() | ||
wait := cond.Wait() | ||
|
||
require.NoError(t, cond.Close()) |
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.
In its current implementation, Close()
always returns nil
, even when the API doc states otherwise.
select { | ||
case _, ok := <-cond.Done(): | ||
if ok { | ||
require.Fail(t, "new cond-closed channel should be closed") | ||
} | ||
case <-time.After(time.Second / 10): | ||
require.Fail(t, "cond should be still closed") | ||
} |
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.
Again, same .done
channel as already checked in the select
above.
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.
What you digged out is an implementation detail which tests don't rely on.
No description provided.