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

test: convert some test code from crashable to failable #4125

Merged
merged 8 commits into from
Jun 28, 2024

Conversation

armcknight
Copy link
Member

@armcknight armcknight commented Jun 27, 2024

Helps fix #3576

I hit one of these today so just went through and removed some easy ones. There are still almost 603 uses of the force unwrap operator and 154 unchecked array indexes in the test code after these changes.

image image

#skip-changelog

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 98.54227% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.347%. Comparing base (df50619) to head (f3b7098).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4125       +/-   ##
=============================================
+ Coverage   91.338%   91.347%   +0.008%     
=============================================
  Files          610       608        -2     
  Lines        48421     48308      -113     
  Branches     17351     17356        +5     
=============================================
- Hits         44227     44128       -99     
+ Misses        4101      4088       -13     
+ Partials        93        92        -1     
Files Coverage Δ
...ts/SentryTests/Helper/SentryFileManagerTests.swift 99.125% <100.000%> (+0.006%) ⬆️
...rformance/CoreData/SentryCoreDataTrackerTest.swift 88.636% <100.000%> (ø)
...reData/SentryCoreDataTrackingIntegrationTest.swift 100.000% <100.000%> (ø)
...ns/Performance/SentryPerformanceTrackerTests.swift 100.000% <100.000%> (ø)
...ions/SentryCrash/SentryCrashIntegrationTests.swift 84.888% <100.000%> (ø)
...SentryWatchdogTerminationsScopeObserverTests.swift 100.000% <100.000%> (ø)
...Tests/Networking/SentryTransportFactoryTests.swift 100.000% <100.000%> (ø)
Tests/SentryTests/PrivateSentrySDKOnlyTests.swift 99.624% <100.000%> (+0.007%) ⬆️
...SentryTests/Protocol/SentryClientReportTests.swift 100.000% <100.000%> (ø)
Tests/SentryTests/Protocol/SentryEventTests.swift 100.000% <100.000%> (ø)
... and 18 more

... and 43 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df50619...f3b7098. Read the comment docs.

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Thanks. We should keep using this approach, it makes safer tests.

@armcknight armcknight merged commit 4597906 into main Jun 28, 2024
46 of 48 checks passed
@armcknight armcknight deleted the armcknight/test/remove-some-swift-forces branch June 28, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove force unwraps from test code
2 participants