File tree Expand file tree Collapse file tree 26 files changed +248
-28
lines changed
Fixtures/MixedTargets/BasicMixedTargets
MixedTargetWithCustomModuleMap
MixedTargetWithCustomModuleMapAndResources/include
MixedTargetWithCustomModuleMapTests
MixedTargetWithPublicCXXAPITests Expand file tree Collapse file tree 26 files changed +248
-28
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ let package = Package(
66
66
. target(
67
67
name: " MixedTargetWithCustomModuleMap "
68
68
) ,
69
+ . testTarget(
70
+ name: " MixedTargetWithCustomModuleMapTests " ,
71
+ dependencies: [ " MixedTargetWithCustomModuleMap " ]
72
+ ) ,
69
73
70
74
// MARK: - MixedTargetWithInvalidCustomModuleMap
71
75
. target(
Original file line number Diff line number Diff line change 4
4
#import " Driver.h"
5
5
#import " include/Driver.h"
6
6
7
- @implementation Driver
7
+ @implementation MyDriver
8
8
@end
Original file line number Diff line number Diff line change 1
1
import Foundation
2
2
3
3
// This type is Objective-C compatible and used in `OldCar`.
4
- @objc public class Engine : NSObject { }
4
+ @objc public class Engine : MyMachine { }
Original file line number Diff line number Diff line change
1
+ #import < Foundation/Foundation.h>
2
+
3
+ // Both import statements should be supported.
4
+ #import " Machine.h"
5
+ #import " include/Machine.h"
6
+
7
+ @implementation MyMachine
8
+ @end
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import Foundation
3
3
public class NewCar {
4
4
// `Engine` is defined in Swift.
5
5
var engine : Engine ? = nil
6
- // `Driver` is defined in Objective-C.
7
- var driver : Driver ? = nil
6
+ // `MyDriver` is defined in Objective-C.
7
+ var driver : MyDriver ? = nil
8
+
9
+ public init ( ) { }
8
10
}
Original file line number Diff line number Diff line change 7
7
// Import the Swift part of the module.
8
8
#import " MixedTargetWithCustomModuleMap-Swift.h"
9
9
10
- @implementation OldCar
10
+ @implementation MyOldCar
11
11
@end
Original file line number Diff line number Diff line change 1
1
#import < Foundation/Foundation.h>
2
2
3
3
// This type is Swift compatible and used in `NewCar`.
4
- @interface Driver : NSObject
4
+ // `My` prefix is to avoid naming collision in test bundle.
5
+ @interface MyDriver : NSObject
5
6
@property (nonnull ) NSString * name;
6
7
@end
Original file line number Diff line number Diff line change
1
+ #import < Foundation/Foundation.h>
2
+
3
+ // This type is subclassed by the Swift type `Engine`.
4
+ // `My` prefix is to avoid naming collision in test bundle.
5
+ @interface MyMachine : NSObject
6
+ @end
Original file line number Diff line number Diff line change
1
+ #import " Machine.h"
1
2
#import " OldCar.h"
2
3
#import " Driver.h"
Original file line number Diff line number Diff line change 6
6
// must be forward declared in headers.
7
7
@class Engine;
8
8
9
- @interface OldCar : NSObject
9
+ // `My` prefix is to avoid naming collision in test bundle.
10
+ @interface MyOldCar : NSObject
10
11
// `Engine` is defined in Swift.
11
12
@property (nullable ) Engine *engine;
12
13
// `Driver` is defined in Objective-C.
13
- @property (nullable ) Driver *driver;
14
+ @property (nullable ) MyDriver *driver;
14
15
@end
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
module MixedTargetWithCustomModuleMapAndResources {
2
- umbrella header "MixedTarget .h"
2
+ umbrella header "MixedTargetWithCustomModuleMapAndResources .h"
3
3
export *
4
4
}
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ #import " BasicMixedTarget-Swift.h"
4
+ #import " BasicMixedTarget/BasicMixedTarget.h"
5
+
6
+ @interface ObjcBasicMixedTargetTestsViaBridgingHeader : XCTestCase
7
+
8
+ @end
9
+
10
+ @implementation ObjcBasicMixedTargetTestsViaBridgingHeader
11
+
12
+ - (void )testPublicSwiftAPI {
13
+ // Check that Objective-C compatible Swift API surface is exposed...
14
+ Engine *engine = [[Engine alloc ] init ];
15
+ }
16
+
17
+ - (void )testPublicObjcAPI {
18
+ // Check that Objective-C API surface is exposed...
19
+ OldCar *oldCar = [[OldCar alloc ] init ];
20
+ Driver *driver = [[Driver alloc ] init ];
21
+ CarPart *carPart = [[CarPart alloc ] init ];
22
+ }
23
+
24
+ @end
Original file line number Diff line number Diff line change 2
2
3
3
@import BasicMixedTarget;
4
4
5
- @interface ObjcBasicMixedTargetTests : XCTestCase
5
+ @interface ObjcBasicMixedTargetTestsViaHeaderImport : XCTestCase
6
6
7
7
@end
8
8
9
- @implementation ObjcBasicMixedTargetTests
9
+ @implementation ObjcBasicMixedTargetTestsViaHeaderImport
10
10
11
11
- (void )testPublicSwiftAPI {
12
12
// Check that Objective-C compatible Swift API surface is exposed...
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ #import " CarPart.h"
4
+ #import " Driver.h"
5
+ #import " OldCar.h"
6
+ #import " BasicMixedTarget-Swift.h"
7
+
8
+ @interface ObjcBasicMixedTargetTestsViaModuleImport : XCTestCase
9
+
10
+ @end
11
+
12
+ @implementation ObjcBasicMixedTargetTestsViaModuleImport
13
+
14
+ - (void )testPublicSwiftAPI {
15
+ // Check that Objective-C compatible Swift API surface is exposed...
16
+ Engine *engine = [[Engine alloc ] init ];
17
+ }
18
+
19
+ - (void )testPublicObjcAPI {
20
+ // Check that Objective-C API surface is exposed...
21
+ OldCar *oldCar = [[OldCar alloc ] init ];
22
+ Driver *driver = [[Driver alloc ] init ];
23
+ CarPart *carPart = [[CarPart alloc ] init ];
24
+ }
25
+
26
+ @end
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ // Import the target via header imports.
4
+ #import < BasicMixedTargetWithManualBridgingHeader/BasicMixedTargetWithManualBridgingHeader.h>
5
+ #import < BasicMixedTargetWithManualBridgingHeader/OldPlane.h>
6
+ #import < BasicMixedTargetWithManualBridgingHeader/Pilot.h>
7
+ #import < BasicMixedTargetWithManualBridgingHeader/PlanePart.h>
8
+ #import < BasicMixedTargetWithManualBridgingHeader-Swift.h>
9
+
10
+ @interface ObjcBasicMixedTargetWithManualBridgingHeaderTestsViaHeaderImport : XCTestCase
11
+
12
+ @end
13
+
14
+ @implementation ObjcBasicMixedTargetWithManualBridgingHeaderTestsViaHeaderImport
15
+
16
+ - (void )testPublicSwiftAPI {
17
+ // Check that Objective-C compatible Swift API surface is exposed...
18
+ Engine *engine = [[Engine alloc ] init ];
19
+ }
20
+
21
+ - (void )testPublicObjcAPI {
22
+ // Check that Objective-C API surface is exposed...
23
+ OldPlane *oldPlane = [[OldPlane alloc ] init ];
24
+ Pilot *pilot = [[Pilot alloc ] init ];
25
+ }
26
+
27
+ @end
Original file line number Diff line number Diff line change 1
1
#import < XCTest/XCTest.h>
2
2
3
+ // Import the target via a module import.
3
4
@import BasicMixedTargetWithManualBridgingHeader;
4
5
5
- @interface ObjcBasicMixedTargetWithManualBridgingHeaderTests : XCTestCase
6
+ @interface ObjcBasicMixedTargetWithManualBridgingHeaderTestsViaModuleImport : XCTestCase
6
7
7
8
@end
8
9
9
- @implementation ObjcBasicMixedTargetWithManualBridgingHeaderTests
10
+ @implementation ObjcBasicMixedTargetWithManualBridgingHeaderTestsViaModuleImport
10
11
11
12
- (void )testPublicSwiftAPI {
12
13
// Check that Objective-C compatible Swift API surface is exposed...
Original file line number Diff line number Diff line change
1
+ import XCTest
2
+ import MixedTargetWithCustomModuleMap
3
+
4
+ final class MixedTargetWithCustomModuleMapTests : XCTestCase {
5
+
6
+ func testPublicSwiftAPI( ) throws {
7
+ // Check that Swift API surface is exposed...
8
+ let _ = NewCar ( )
9
+ let _ = Engine ( )
10
+ }
11
+
12
+ func testPublicObjcAPI( ) throws {
13
+ // Check that Objective-C API surface is exposed...
14
+ let _ = MyOldCar ( )
15
+ let _ = MyDriver ( )
16
+ let _ = MyMachine ( )
17
+ }
18
+
19
+ func testModulePrefixingWorks( ) throws {
20
+ let _ = MixedTargetWithCustomModuleMap . MyMachine ( )
21
+ let _ = MixedTargetWithCustomModuleMap . NewCar ( )
22
+ let _ = MixedTargetWithCustomModuleMap . Engine ( )
23
+ let _ = MixedTargetWithCustomModuleMap . MyOldCar ( )
24
+ let _ = MixedTargetWithCustomModuleMap . MyDriver ( )
25
+ }
26
+
27
+ }
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ #import " MixedTargetWithCustomModuleMap/MixedTargetWithCustomModuleMap.h"
4
+ #import " MixedTargetWithCustomModuleMap-Swift.h"
5
+
6
+ @interface ObjcMixedTargetWithCustomModuleMapTestsViaGeneratedBridgingHeader : XCTestCase
7
+ @end
8
+
9
+ @implementation ObjcMixedTargetWithCustomModuleMapTestsViaGeneratedBridgingHeader
10
+
11
+ - (void )testPublicSwiftAPI {
12
+ // Check that Objective-C compatible Swift API surface is exposed...
13
+ Engine *engine = [[Engine alloc ] init ];
14
+ }
15
+
16
+ - (void )testPublicObjcAPI {
17
+ // Check that Objective-C API surface is exposed...
18
+ MyMachine *machine = [[MyMachine alloc ] init ];
19
+ MyOldCar *oldCar = [[MyOldCar alloc ] init ];
20
+ MyDriver *driver = [[MyDriver alloc ] init ];
21
+ }
22
+
23
+ @end
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ #import " Machine.h"
4
+ #import " MixedTarget.h"
5
+ #import " Driver.h"
6
+ #import " OldCar.h"
7
+ #import " MixedTargetWithCustomModuleMap-Swift.h"
8
+
9
+ @interface ObjcMixedTargetWithCustomModuleMapTestsViaHeaderImport : XCTestCase
10
+ @end
11
+
12
+ @implementation ObjcMixedTargetWithCustomModuleMapTestsViaHeaderImport
13
+
14
+ - (void )testPublicSwiftAPI {
15
+ // Check that Objective-C compatible Swift API surface is exposed...
16
+ Engine *engine = [[Engine alloc ] init ];
17
+ }
18
+
19
+ - (void )testPublicObjcAPI {
20
+ // Check that Objective-C API surface is exposed...
21
+ MyMachine *machine = [[MyMachine alloc ] init ];
22
+ MyOldCar *oldCar = [[MyOldCar alloc ] init ];
23
+ MyDriver *driver = [[MyDriver alloc ] init ];
24
+ }
25
+
26
+ @end
Original file line number Diff line number Diff line change
1
+ #import < XCTest/XCTest.h>
2
+
3
+ @import MixedTargetWithCustomModuleMap;
4
+
5
+ @interface ObjcMixedTargetWithCustomModuleMapTestsViaModuleImport : XCTestCase
6
+ @end
7
+
8
+ @implementation ObjcMixedTargetWithCustomModuleMapTestsViaModuleImport
9
+
10
+ - (void )testPublicSwiftAPI {
11
+ // Check that Objective-C compatible Swift API surface is exposed...
12
+ Engine *engine = [[Engine alloc ] init ];
13
+ }
14
+
15
+ - (void )testPublicObjcAPI {
16
+ // Check that Objective-C API surface is exposed...
17
+ MyMachine *machine = [[MyMachine alloc ] init ];
18
+ MyOldCar *oldCar = [[MyOldCar alloc ] init ];
19
+ MyDriver *driver = [[MyDriver alloc ] init ];
20
+ }
21
+
22
+ @end
Original file line number Diff line number Diff line change 4
4
#import " ObjcCalculator.h"
5
5
#import " MixedTargetWithPublicCXXAPI-Swift.h"
6
6
7
- @interface ObjcMixedTargetWithPublicCXXAPIViaModuleImportTests : XCTestCase
7
+ @interface ObjcMixedTargetWithPublicCXXAPITestsViaHeaderImport : XCTestCase
8
8
@end
9
9
10
- @implementation ObjcMixedTargetWithPublicCXXAPIViaModuleImportTests
10
+ @implementation ObjcMixedTargetWithPublicCXXAPITestsViaHeaderImport
11
11
12
12
- (void )testPublicObjcAPI {
13
13
XCTAssertEqual ([ObjcCalculator factorialForInt: 5 ], 120 );
Original file line number Diff line number Diff line change 2
2
3
3
@import MixedTargetWithPublicCXXAPI;
4
4
5
- @interface ObjcMixedTargetWithPublicCXXAPIViaModuleImportTests : XCTestCase
5
+ @interface ObjcMixedTargetWithPublicCXXAPITestsViaModuleImport : XCTestCase
6
6
@end
7
7
8
- @implementation ObjcMixedTargetWithPublicCXXAPIViaModuleImportTests
8
+ @implementation ObjcMixedTargetWithPublicCXXAPITestsViaModuleImport
9
9
10
10
- (void )testPublicObjcAPI {
11
11
XCTAssertEqual ([ObjcCalculator factorialForInt: 5 ], 120 );
You can’t perform that action at this time.
0 commit comments