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

Add XCTAssertThrowsSpecific #535

Merged
merged 10 commits into from Oct 10, 2019
Merged

Add XCTAssertThrowsSpecific #535

merged 10 commits into from Oct 10, 2019

Conversation

fortmarek
Copy link
Member

@fortmarek fortmarek commented Oct 6, 2019

Short description πŸ“

I have noticed that we frequently test for specific errors, so I figured it'd be nice to add a convenience method to XCTestCase to make this more streamlined.

Solution πŸ“¦

Adding extension to XCTestCase called XCTAssertThrowsSpecific (same as similar obj-c method); the expected error must conform to Equatable and Swift.Error.

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • Add XCTAssertThrowsSpecific method
  • Add example usage
  • Go through tests and change to this method (I'll do this once I get validated that we want to use it as-is)

@fortmarek fortmarek requested a review from a team October 6, 2019 14:28
@codecov
Copy link

codecov bot commented Oct 6, 2019

Codecov Report

Merging #535 into master will decrease coverage by <.01%.
The diff coverage is 97.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
- Coverage   91.34%   91.34%   -0.01%     
==========================================
  Files         364      364              
  Lines       19478    19473       -5     
==========================================
- Hits        17793    17787       -6     
- Misses       1685     1686       +1
Impacted Files Coverage Ξ”
...ts/TuistEnvKitTests/Installer/InstallerTests.swift 98.09% <100%> (-0.02%) ⬇️
Tests/TuistGeneratorTests/Graph/SDKNodeTests.swift 100% <100%> (ΓΈ) ⬆️
Tests/TuistEnvKitTests/GitHub/ReleaseTests.swift 100% <100%> (ΓΈ) ⬆️
...itTests/Playgrounds/PlaygroundGeneratorTests.swift 100% <100%> (ΓΈ) ⬆️
Sources/TuistKit/Models/Up/UpHomebrew.swift 100% <100%> (ΓΈ) ⬆️
.../TuistKitTests/Commands/GenerateCommandTests.swift 99.29% <100%> (ΓΈ) ⬆️
...eratorTests/Graph/GraphCircularDetectorTests.swift 100% <100%> (ΓΈ) ⬆️
...KitTests/Generator/GeneratorModelLoaderTests.swift 97.42% <100%> (-0.01%) ⬇️
Tests/TuistKitTests/Setup/SetupLoaderTests.swift 100% <100%> (ΓΈ) ⬆️
...ts/TuistCoreTests/Xcode/XcodeControllerTests.swift 100% <100%> (ΓΈ) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 3f323e4...5fffc04. Read the comment docs.

@tuistbot
Copy link
Contributor

tuistbot commented Oct 6, 2019

1 Warning
⚠️ Have you introduced any user-facing changes? If so, please take some time to update the documentation. Keeping the documentation up to date makes it easier for users to learn how to use Tuist.

Generated by 🚫 Danger

Copy link
Collaborator

@ollieatkinson ollieatkinson left a comment

Choose a reason for hiding this comment

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

Nice improvement πŸ‘

Go through tests and change to this method (I'll do this once I get validated that we want to use it as-is)

Change the ones you are comfortable changing

@pepicrft
Copy link
Contributor

pepicrft commented Oct 7, 2019

@fortmarek Swiftlint & Swiftformat don't seem happy with the changes :)

@pepicrft pepicrft merged commit 8ff63bf into master Oct 10, 2019
@pepicrft pepicrft deleted the throws-specific branch October 10, 2019 14:53
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.

None yet

4 participants