https://github.com/ryanashcraft/badaccessplayground
https://github.com/ryanashcraft/badaccessplayground
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/ryanashcraft/badaccessplayground
- Owner: ryanashcraft
- Created: 2023-10-03T23:27:49.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-10T01:34:35.000Z (almost 3 years ago)
- Last Synced: 2025-04-06T12:12:05.832Z (over 1 year ago)
- Language: Swift
- Size: 14.5 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BadAccessPlayground
I'm trying to understand why this unit test (often) produces EXC_BAD_ACCESS errors. Is the code doing something unsafe? Take a look at [CombineTests.swift](/BadAccessPlaygroundTests/CombineTests.swift).
## Instructions
1. Open BadAccessPlayground.xcodeproj in Xcode 15
2. Run the testBadAccess() test in CombineTests.swift [repeatedly until failure](https://www.avanderlee.com/debugging/flaky-tests-test-repetitions/). Recommended 10000+ max iterations.
3. Repeat until you witness a EXC_BAD_ACCESS error
## Additional Tests
- See the simplified test case testBadAccessSimplified(), which removes the usage of the Store class and managing cancellable handlers.
- See testBadAccess() in OpenCombineTests.swift, which uses [OpenCombine](https://github.com/OpenCombine/OpenCombine) instead of Apple's Combine. A EXC_BAD_ACCESS error can also be observed.
- See testNoBadAccess() in PromisesTests.swift, which uses [Promises](https://github.com/google/promises) to implement a similar test case. This test does not seem to exhibit a EXC_BAD_ACCESS error.
## Screenshots

