|
| 1 | +// |
| 2 | +// Build objc_implementation.framework |
| 3 | +// |
| 4 | +// RUN: %empty-directory(%t) |
| 5 | +// RUN: %empty-directory(%t/frameworks) |
| 6 | +// RUN: %empty-directory(%t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule) |
| 7 | +// RUN: %empty-directory(%t/frameworks/objc_implementation.framework/Headers) |
| 8 | +// RUN: cp %S/Inputs/objc_implementation.modulemap %t/frameworks/objc_implementation.framework/Modules/module.modulemap |
| 9 | +// RUN: cp %S/Inputs/objc_implementation.h %t/frameworks/objc_implementation.framework/Headers |
| 10 | +// RUN: %target-build-swift-dylib(%t/frameworks/objc_implementation.framework/objc_implementation) -emit-module-path %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t/frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t/frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift |
| 11 | + |
| 12 | +// |
| 13 | +// Execute this file |
| 14 | +// |
| 15 | +// RUN: %empty-directory(%t/swiftmod) |
| 16 | +// RUN: %target-build-swift %s -module-cache-path %t/swiftmod/mcp -F %t/frameworks -o %t/swiftmod/a.out -module-name main |
| 17 | +// RUN: %target-codesign %t/swiftmod/a.out |
| 18 | +// RUN: %target-run %t/swiftmod/a.out | %FileCheck %s |
| 19 | + |
| 20 | +// |
| 21 | +// Execute again, without the swiftmodule this time |
| 22 | +// |
| 23 | +// RUN: mv %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule.disabled |
| 24 | +// RUN: %empty-directory(%t/clangmod) |
| 25 | +// RUN: %target-build-swift %s -module-cache-path %t/clangmod/mcp -F %t/frameworks -o %t/clangmod/a.out -module-name main |
| 26 | +// RUN: %target-codesign %t/clangmod/a.out |
| 27 | +// RUN: %target-run %t/clangmod/a.out | %FileCheck %s |
| 28 | + |
| 29 | +// REQUIRES: executable_test |
| 30 | +// REQUIRES: objc_interop |
| 31 | + |
| 32 | +import Foundation |
| 33 | +import objc_implementation |
| 34 | + |
| 35 | +ImplClass.runTests() |
| 36 | +// CHECK: ImplClass.someMethod() |
| 37 | +// CHECK: SwiftSubclass.someMethod() |
| 38 | + |
| 39 | +print(ImplClass().someMethod()) |
| 40 | +// CHECK: ImplClass.someMethod() |
| 41 | + |
| 42 | +class SwiftClientSubclass: ImplClass { |
| 43 | + override func someMethod() -> String { "SwiftClientSubclass.someMethod()" } |
| 44 | +} |
| 45 | + |
| 46 | +print(SwiftClientSubclass().someMethod()) |
| 47 | +// CHECK: SwiftClientSubclass.someMethod() |
| 48 | + |
0 commit comments