Skip to content

Commit c3e0747

Browse files
Suyash SrijanSuyash Srijan
authored andcommitted
[test] add a dynamic self test file
1 parent 34c46d9 commit c3e0747

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

test/PrintAsObjC/dynamicself.swift

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
1+
// REQUIRES: objc_interop
2+
13
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -module-name dynamicself -disable-objc-attr-requires-foundation-module
3-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/dynamicself.swiftmodule -typecheck -emit-objc-header-path %t/dynamicself.h -disable-objc-attr-requires-foundation-module
4-
// RUN: %FileCheck %s < %t/dynamicself.h
5-
// RUN: %check-in-clang %t/dynamicself.h
64

7-
// REQUIRES: objc_interop
5+
// FIXME: BEGIN -enable-source-import hackaround
6+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -disable-objc-attr-requires-foundation-module
7+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
8+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
9+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/AppKit.swift
10+
// FIXME: END -enable-source-import hackaround
11+
12+
13+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -I %S/Inputs/custom-modules -o %t %s -disable-objc-attr-requires-foundation-module
14+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/dynamicself.swiftmodule -typecheck -I %S/Inputs/custom-modules -emit-objc-header-path %t/dynamicself.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module
15+
// RUN: %FileCheck %s < %t/dynamicself.h
16+
// RUN: %check-in-clang -I %S/Inputs/custom-modules/ %t/dynamicself.h
817

918
import Foundation
1019

1120
// CHECK-LABEL: @protocol FooProtocol
12-
// CHECK-NEXT: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
13-
// CHECK-NEXT: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
14-
// CHECK-NEXT: @end
15-
1621
@objc protocol FooProtocol {
22+
// CHECK: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
1723
func fooFunc() -> Self
24+
// CHECK: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
1825
func optionalFooFunc() -> Self?
1926
}
27+
// CHECK: @end
2028

2129
// CHECK-LABEL: @interface BarClass : NSObject <FooProtocol>
22-
// CHECK-NEXT: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
23-
// CHECK-NEXT: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
24-
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
25-
// CHECK-NEXT: @end
26-
2730
@objc @objcMembers class BarClass: NSObject, FooProtocol {
31+
// CHECK: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
2832
func fooFunc() -> Self { return self }
33+
// CHECK: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
2934
func optionalFooFunc() -> Self? { return self }
35+
// CHECK: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
3036
}
37+
// CHECK: @end

0 commit comments

Comments
 (0)