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

Update all uses of next to check done before consuming value #19637

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

deyaaeldeen
Copy link
Member

@deyaaeldeen deyaaeldeen commented Jan 5, 2022

We should check done before consuming value of any IteratorResult. This PR adds a new test utility, getYieldedValue, that takes an IteratorResult as input and returns the yielded value if the iterator was not done yet, otherwise, it throws an assertion failure. Furthermore, this PR uses this utility in all tests that do not check the done field.

The PR was inspired by #19507 (review)

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

Changes seem straightforward, one file delete stood out though

* @param iteratorResult The result of the current iteration
* @returns the currently yielded value
*/
export function getYieldedValue<YT, RT>(iteratorResult: IteratorResult<YT, RT>): YT {
Copy link
Member

Choose a reason for hiding this comment

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

❤️

@deyaaeldeen deyaaeldeen merged commit e31b7fc into Azure:main Jan 5, 2022
@deyaaeldeen deyaaeldeen deleted the core-paging/set-return-val-void branch January 5, 2022 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants