11#if !os(macOS)
22import SwiftUI
33import SwiftUIIntrospect
4- import XCTest
4+ import Testing
55
66@MainActor
7- final class ViewControllerTests : XCTestCase {
8- func testViewController( ) {
9- XCTAssertViewIntrospection ( of: PlatformViewController . self) { spies in
10- let spy0 = spies [ 0 ]
11- let spy1 = spies [ 1 ]
12- let spy2 = spies [ 2 ]
13-
7+ @Suite
8+ struct ViewControllerTests {
9+ @Test func introspect( ) async throws {
10+ let ( entity1, entity2, entity3) = try await introspection ( of: PlatformViewController . self) { spy1, spy2, spy3 in
1411 TabView {
1512 NavigationView {
1613 Text ( " Root " ) . frame ( maxWidth: . infinity, maxHeight: . infinity) . background ( Color . red)
1714 . introspect (
1815 . viewController,
1916 on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) ,
20- customize: spy2
17+ customize: spy3
2118 )
2219 }
2320 . navigationViewStyle ( . stack)
@@ -28,22 +25,21 @@ final class ViewControllerTests: XCTestCase {
2825 . introspect (
2926 . viewController,
3027 on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) ,
31- customize: spy1
28+ customize: spy2
3229 )
3330 }
3431 . introspect (
3532 . viewController,
3633 on: . iOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . tvOS( . v13, . v14, . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26) ,
37- customize: spy0
34+ customize: spy1
3835 )
39- } extraAssertions: {
40- #if !os(visionOS)
41- XCTAssert ( $0 [ safe: 0 ] is UITabBarController )
42- #endif
43- XCTAssert ( $0 [ safe: 1 ] is UINavigationController )
44- XCTAssert ( String ( describing: $0 [ safe: 2 ] ) . contains ( " UIHostingController " ) )
45- XCTAssert ( $0 [ safe: 1 ] === $0 [ safe: 2 ] ? . parent)
4636 }
37+ #if !os(visionOS)
38+ #expect( entity1 is UITabBarController )
39+ #endif
40+ #expect( entity2 is UINavigationController )
41+ #expect( String ( describing: entity3) . contains ( " UIHostingController " ) )
42+ #expect( entity2 === entity3. parent)
4743 }
4844}
4945#endif
0 commit comments