test: 런타임 테스트를 XCTest 에서 swift-testing 으로 마이그레이션#26
Conversation
순수 런타임 테스트 30개 파일을 swift-testing 으로 이관한다 (#expect/#require, @test, struct suite). 매크로 확장 테스트 12개 파일은 SwiftSyntaxMacrosTestSupport 의 assertMacroExpansion 이 XCTest 기반이므로 유지한다. 전체 테스트 수는 360개로 동일하며(유실 없음), XCTest 는 이제 매크로 확장 스위트만 담당한다.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (30)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
배경
테스트 스위트가 두 프레임워크로 나뉘어 있었습니다: XCTest 42개 + swift-testing 26개. 진행 중이던 이관을 마무리해 런타임 테스트가 단일 프레임워크(swift-testing)를 쓰도록 통일합니다.
변경사항
순수 런타임 XCTest 30개 파일을 swift-testing 으로 이관합니다. 매크로 확장 테스트 12개는
SwiftSyntaxMacrosTestSupport.assertMacroExpansion이 XCTest 기반이라 의도적으로 유지합니다.변환 규칙(1:1):
import XCTestimport Testing(+ 필요 시import Foundation)final class X: XCTestCase {struct X {func testFoo()@Test func testFoo()XCTAssertEqual(a, b)#expect(a == b)XCTAssertEqual(a, b, accuracy: t)#expect(abs(a - b) < t)XCTAssertNil(a)/XCTAssertTrue(a)#expect(a == nil)/#expect(a)XCTAssertThrowsError(try f())#expect(throws: (any Error).self) { try f() }try XCTUnwrap(x)try #require(x)XCTFail("msg")Issue.record("msg")실제 변환 예시:
변경 파일 (30개, 그룹별)
AnyCodableTests,AnyDecodableTests,AnyEncodableTestsDefaulEmptyDictionaryTests,DefaultCodableTests,DefaultEmptyArrayTests,DefaultEmptyStringTests,DefaultFalseTests,DefaultTrueTests,DefaultZeroDoubleTests,DefaultZeroFloatTests,DefaultZeroIntTestsLosslessArrayTests,LosslessCustomValueTests,LosslessValueTestsLossyArrayTests,LossyDictionaryTests,LossyOptionalTestsDateValueTests,OptionalDateValueTests,DataValueTestsDefaultEmptyPolymorphicArrayValueTests,PolymorphicLossyArrayValueTests,PolymorphicEnumCodableTests,PolymorphicEnumDecodableTests,LossyOptionalPolymorphicValueTests,PolymorphicValueTestsRawRepresentableTests,Encodable+ToDictionaryTests,StringSnakeCaseTests30 files changed, +475 / −454
변경했을 때의 트레이드 오프
assertMacroExpansion제약). 추후SwiftSyntaxMacrosGenericTestSupport로의 이관은 별건 후속 과제.test접두사 유지 — swift-testing 은 접두사가 불필요하지만, diff/네이밍 변경 리스크를 줄이기 위해 이름은 그대로 두고@Test만 부착했습니다.accuracy:가 swift-testing 에 없어#expect(abs(a - b) < t)로 옮겼습니다 — 허용 오차 의미를 보존합니다.테스트 방법
swift test -c debug/swift test -c release— 전부 통과(실패 0).import XCTest잔존 파일은 정확히 12개이며 전부assertMacroExpansion사용(매크로 확장 스위트)임을 확인.기타
DefaulEmptyDictionaryTests, 디렉터리Extenstions/)는 범위를 넘지 않도록 이 PR 에서 건드리지 않았습니다(별건).