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

Iterator concurrent modification tests #242

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Iterator concurrent modification tests #242

merged 1 commit into from
Jan 11, 2024

Conversation

bmeike
Copy link
Contributor

@bmeike bmeike commented Jan 10, 2024

First steps in the process of normalizing the behavior of collection iterators, across platforms.

In creating this group of tests I've discovered that it makes a difference whether the call to toMutable is on the container or its element. Will have to add more tests to handle these cases.

testConcurrentModOfSavedArrayIteratorMember fails. I believe this to be a bug in the Iterator, not the test.

@bmeike bmeike self-assigned this Jan 10, 2024
Copy link
Collaborator

@jeffdgr8 jeffdgr8 left a comment

Choose a reason for hiding this comment

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

These tests look comprehensive to cover the expectation that direct mutations to a collection during iteration should throw ConcurrentModificationExceptions, while mutations to child collections should not cause an exception (where currently the first mutation to a saved child collection does).

These should be able to replace these existing tests. And adding similar tests for MutableDictionary could replace these as well.

Then there's the question of whether this behavior should also apply to MutableDocument. I would think it should to be consistent, but currently there aren't similar tests and ConcurrentModificationExceptions isn't thrown by its iterator.

@bmeike
Copy link
Contributor Author

bmeike commented Jan 11, 2024

Thanks @jeffdgr8. Excellent.

  • Will remove the redundant tests.
  • Will add tests for Dictionary and remove redundant tests
  • Will add tests for Document.

@bmeike
Copy link
Contributor Author

bmeike commented Jan 11, 2024

Done, FWIW.
It is amazing how painful it is to write 39 nearly identical tests....

Copy link
Collaborator

@jeffdgr8 jeffdgr8 left a comment

Choose a reason for hiding this comment

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

Of course there's also the fact there's a couple dozen ways to mutate each collection type, but I'm not sure it's worth blowing up the tests exponentially to account for each of them. 😅

@bmeike bmeike merged commit d533645 into master Jan 11, 2024
@bmeike bmeike deleted the pr/concurrent-mod branch January 11, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants