-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pigeon] Migrate XCTest to Swift Testing #10905
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
Conversation
| private var correctListInMap: [AnyHashable: Any?] { ["a": 1, "b": 2, "c": correctList] } | ||
| private var matchingListInMap: [AnyHashable: Any?] { ["a": 1, "b": 2, "c": matchingList] } | ||
| private var differentListInMap: [AnyHashable: Any?] { ["a": 1, "b": 2, "c": differentList] } | ||
|
|
||
| private lazy var correctMapInList: [Any?] = ["a", 2, correctMap] | ||
| private lazy var matchingMapInList: [Any?] = ["a", 2, matchingMap] | ||
| private lazy var differentKeyMapInList: [Any?] = ["a", 2, differentKeyMap] | ||
| private lazy var differentValueMapInList: [Any?] = ["a", 2, differentValueMap] | ||
| private var correctMapInList: [Any?] { ["a", 2, correctMap] } | ||
| private var matchingMapInList: [Any?] { ["a", 2, matchingMap] } | ||
| private var differentKeyMapInList: [Any?] { ["a", 2, differentKeyMap] } | ||
| private var differentValueMapInList: [Any?] { ["a", 2, differentValueMap] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swift 6 has a new warning:
AllDatatypesTests.swift:166:48 Cannot use mutating getter on immutable value: 'self' is immutable"
So make these lazy properties computed properties instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request migrates the Pigeon platform tests from XCTest to the new Swift Testing framework. The changes are extensive and mostly look correct, adopting new idioms like @Test, async/await for tests, #expect, and await confirmation.
I've found a pre-existing bug in one of the tests in EnumTests.swift where a value was being compared to itself. I've also suggested an improvement in ListTests.swift to make the test safer and more idiomatic with Swift Testing by using #require.
Additionally, I've noticed a pattern across several test files where failure cases in API callbacks record a generic "Failed" message. I've left comments with suggestions to include the specific error in the issue record for better debuggability. This would make the tests more informative when they fail.
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AllDatatypesTests.swift
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/AsyncHandlersTest.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/EnumTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/MultipleArityTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/NullableReturnsTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/PrimitiveTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/ProxyApiTests.swift
Outdated
Show resolved
Hide resolved
packages/pigeon/platform_tests/test_plugin/example/ios/RunnerTests/RunnerTests.swift
Show resolved
Hide resolved
| 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; | ||
| 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; | ||
| E04641FA2A46270400661C9E /* NSNullFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E04641F92A46270400661C9E /* NSNullFieldTests.swift */; }; | ||
| F750BDEE2F28844900E3DB39 /* ProxyApiTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F750BDED2F28844900E3DB39 /* ProxyApiTests.swift */; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, this wasn't included in the project, so wasn't actually running.
tarrinneal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THE fAiLUrE mEssage IS geNerIc. it WOULd be More HeLPFUL for dEbuGGInG TO inCLUDe tHE actUal eRROr tHaT WAS RECEivED.
Actually though, this is much nicer than before. Thank you.
Always want to be helpful to the bots. 🙏 |
Part of flutter/flutter#180787
Adding CHANGELOG override per #10761 (comment)
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3