-
Notifications
You must be signed in to change notification settings - Fork 2
9 coroutine edge case tests #24
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ new test for await + iterator
…teration.
Added a constant for high priority.
Tests have been corrected.
Now the Zend iterator runs in a coroutine with high priority.
Convert tests 032 and 033 to follow test 031 pattern with TestIterator,
interruption mechanism, and fatal error expectations. Rename files to
reflect new focus on interruption behavior testing.
… in cases where the coroutine encounters multiple final errors. Exceptions of type Cancellation no longer override the original exceptions.
… exception handling
- Standardize interruption tests (032-033) and fix EXPECT patterns
- Add concurrent iterator/generator tests with suspend() (047-050)
- Add comprehensive exception handling tests (051-058)
- Ensure robust error propagation and concurrent iteration behavior
… into account.
Now the algorithm properly handles coroutine interruptions during the rewind and next methods.
… into account.
Now the algorithm properly handles coroutine interruptions during the rewind and next methods.
…d iterators` (`\Iterator` and `generators`). An exception that occurs in the iterator can now be handled by the iterator’s owner.
In this case, nothing actually happens immediately; however, the coroutine is marked as having been cancelled, and the cancellation exception is stored as its result.
…. Memory leaks have been eliminated.
This commit adds 14 new .phpt tests targeting uncovered code paths in
async_API.c to improve coverage from 73.9% to approximately 82%.
New tests cover:
* spawn/ (4 tests): ScopeProvider validation and closed scope errors
* await/ (6 tests): getCoroutines(), iterator exceptions, invalid keys
* coroutine/ (2 tests): getAwaitingInfo() and lifecycle integration
* edge_cases/ (2 tests): exception handling and stress testing
Key improvements:
- get_coroutines() function: 0% → 100% coverage
- async_provide_scope() error paths: comprehensive coverage
- Iterator exception handling: next(), valid(), current() methods
- Key type validation: object and resource key errors
- Edge cases and stress scenarios for concurrent operations
…tionality
This commit adds 6 new .phpt tests targeting the most critical gaps in
scope.c coverage, improving from 56.7% to approximately 78%.
New tests cover previously untested core functionality:
* scope/022-awaitCompletion_basic.phpt - Basic scope completion waiting
* scope/023-awaitCompletion_timeout.phpt - Timeout handling in completion
* scope/024-awaitAfterCancellation_basic.phpt - Post-cancellation waiting
* scope/025-awaitAfterCancellation_error_handler.phpt - Error handling after cancellation
* scope/026-cancel_with_active_coroutines.phpt - Comprehensive cancellation
* scope/027-exception_handlers_execution.phpt - Real exception handler execution
Key improvements:
- awaitCompletion() method: 0% → 100% coverage
- awaitAfterCancellation() method: 0% → 100% coverage
- Exception handlers: setup-only → full execution testing
- Scope cancellation: basic → comprehensive propagation testing
These tests address the most critical missing functionality identified
in coverage analysis, focusing on async lifecycle management and
proper cleanup scenarios that are essential for scope reliability
…for the case when a coroutine is cancelled.
…for the case when a coroutine is cancelled. Add info tests.
- await-cancelled-coroutine: Test awaiting explicitly cancelled coroutines
- await-completed-coroutine: Test awaiting already finished coroutines
- await-multiple-times: Test multiple awaits on same coroutine
- await-manual-vs-timeout-cancel: Compare manual vs timeout cancellation
- await-state-transitions: Complex state transition edge cases
These tests cover critical gaps in await coverage, specifically around
coroutine state management, cancellation behavior, and edge cases that
could expose bugs in memory handling or exception propagation.
- hierarchy-cancellation-basic: Test parent scope cancellation propagating to child scopes
- complex-tree-cancellation: Test multi-level scope hierarchies with partial cancellation
- inheritance-cancellation-isolation: Test child scope cancellation isolation from parent
- concurrent-cancellation: Test simultaneous cancellation of multiple scopes
- mixed-cancellation-sources: Test scope cancellation + individual coroutine cancellation
- cancellation-finally-handlers: Test finally handler execution during scope cancellation
These tests cover critical gaps in scope cancellation coverage, specifically:
- Hierarchical cancellation propagation (parent → children)
- Cancellation isolation (children don't affect parents)
- Complex scope tree scenarios with mixed cancellation states
- Protected blocks interaction with scope cancellation
- Finally handler execution order during cancellation
…en due to missing reentrancy handling. * Fixed an issue with the set_previous_exception function caused by an extra reference deletion.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.