Skip to content

Commit 0ba51b0

Browse files
authored
[test] Remove overlays with extra NS stripping from the mock SDK (#20954)
There were only two tests still using them, and they weren't hard to migrate over to the normal mock SDK overlays.
1 parent 94942c5 commit 0ba51b0

File tree

11 files changed

+42
-421
lines changed

11 files changed

+42
-421
lines changed

test/IDE/Inputs/custom-modules/OmitNeedlessWords.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ typedef NS_OPTIONS(NSUInteger, OMWWobbleOptions) {
1515

1616
@interface OmitNeedlessWords : NSObject
1717
-(void)jumpToUrl:(nonnull NSURL *)url;
18+
-(void)jumpToGuid:(nonnull NSGUID *)guid;
19+
-(void)jumpAgainToGUID:(nonnull NSGUID *)guid;
1820
-(BOOL)objectIsCompatibleWithObject:(nonnull id)other;
1921
-(void)insetByX:(NSInteger)x y:(NSInteger)y;
2022
-(void)setIndirectlyToValue:(nonnull id)object;
2123
-(void)jumpToTop:(nonnull id)sender;
2224
-(void)removeWithNoRemorse:(nonnull id)object;
2325
-(void)bookmarkWithURLs:(nonnull NSArray<NSURL *> *)urls;
26+
-(void)bookmarkWithGUIDs:(nonnull NSArray<NSGUID *> *)guids;
2427
-(void)saveToURL:(nonnull NSURL *)url forSaveOperation:(NSInteger)operation;
28+
-(void)saveToGUID:(nonnull NSGUID *)guid forSaveOperation:(NSInteger)operation;
2529
-(void)indexWithItemNamed:(nonnull NSString *)name;
2630
-(void)methodAndReturnError:(NSError **)error;
2731
-(nullable Class)typeOfString:(nonnull NSString *)string;

test/IDE/print_omit_needless_words.swift

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// FIXME: this is failing on simulators
55
// REQUIRES: OS=macosx
66

7-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/ObjectiveC.swift
8-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/CoreGraphics.swift
9-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/Foundation.swift
7+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -disable-objc-attr-requires-foundation-module
8+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
9+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
1010

1111
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=ObjectiveC -function-definitions=false -prefer-type-repr=true > %t.ObjectiveC.txt
1212
// RUN: %FileCheck %s -check-prefix=CHECK-OBJECTIVEC -strict-whitespace < %t.ObjectiveC.txt
@@ -86,8 +86,9 @@
8686
// CHECK-FOUNDATION-NEXT: case decimal
8787
// CHECK-FOUNDATION-NEXT: case binary
8888

89-
// Note: Make sure NSURL works in various places
90-
// CHECK-FOUNDATION: open(_: NSURL!, completionHandler: ((Bool) -> Void)!)
89+
// Note: Make sure initialisms work in various places
90+
// CHECK-FOUNDATION: open(_: URL!, completionHandler: ((Bool) -> Void)!)
91+
// CHECK-FOUNDATION: open(_: NSGUID!, completionHandler: ((Bool) -> Void)!)
9192

9293
// Note: property name stripping property type.
9394
// CHECK-FOUNDATION: var uppercased: String
@@ -113,16 +114,18 @@
113114
// CHECK-FOUNDATION: func withString(_: String) -> String
114115

115116
// Note: Noun phrase puts preposition inside.
116-
// CHECK-FOUNDATION: func url(withAddedString: String) -> NSURL?
117+
// CHECK-FOUNDATION: func url(withAddedString: String) -> URL?
118+
// CHECK-FOUNDATION: func guid(withAddedString: String) -> NSGUID?
117119

118120
// Note: NSCalendarUnits is not a set of "Options".
119121
// CHECK-FOUNDATION: func forCalendarUnits(_: NSCalendar.Unit) -> String!
120122

121123
// Note: <property type>By<gerund> --> <gerund>.
122-
// CHECK-FOUNDATION: var deletingLastPathComponent: NSURL? { get }
123-
124124
// Note: <property type><preposition> --> <preposition>.
125-
// CHECK-FOUNDATION: var withHTTPS: NSURL { get }
125+
// CHECK-FOUNDATION: var deletingLastPathComponent: URL? { get }
126+
// CHECK-FOUNDATION: var withHTTPS: URL { get }
127+
// CHECK-FOUNDATION: var canonicalizing: NSGUID? { get }
128+
// CHECK-FOUNDATION: var withContext: NSGUID { get }
126129

127130
// Note: lowercasing option set values
128131
// CHECK-FOUNDATION: struct NSEnumerationOptions
@@ -184,7 +187,8 @@
184187
// CHECK-FOUNDATION: let NSHTTPRequestKey: String
185188

186189
// Lowercasing initialisms with plurals.
187-
// CHECK-FOUNDATION: var urlsInText: [NSURL] { get }
190+
// CHECK-FOUNDATION: var urlsInText: [URL] { get }
191+
// CHECK-FOUNDATION: var guidsInText: [NSGUID] { get }
188192

189193
// Don't strip prefixes from macro names.
190194
// CHECK-FOUNDATION: var NSTimeIntervalSince1970: Double { get }
@@ -201,14 +205,17 @@
201205
// CHECK-OMIT-NEEDLESS-WORDS: static var backAndForth: OMWWobbleOptions
202206
// CHECK-OMIT-NEEDLESS-WORDS: static var toXMLHex: OMWWobbleOptions
203207

204-
// CHECK-OMIT-NEEDLESS-WORDS: func jump(to: NSURL)
208+
// CHECK-OMIT-NEEDLESS-WORDS: func jump(to: URL)
209+
// CHECK-OMIT-NEEDLESS-WORDS: func jump(to: NSGUID)
210+
// CHECK-OMIT-NEEDLESS-WORDS: func jumpAgain(to: NSGUID)
205211
// CHECK-OMIT-NEEDLESS-WORDS: func objectIs(compatibleWith: Any) -> Bool
206212
// CHECK-OMIT-NEEDLESS-WORDS: func insetBy(x: Int, y: Int)
207213
// CHECK-OMIT-NEEDLESS-WORDS: func setIndirectlyToValue(_: Any)
208214
// CHECK-OMIT-NEEDLESS-WORDS: func jumpToTop(_: Any)
209215
// CHECK-OMIT-NEEDLESS-WORDS: func removeWithNoRemorse(_: Any)
210-
// CHECK-OMIT-NEEDLESS-WORDS: func bookmark(with: [NSURL])
211-
// CHECK-OMIT-NEEDLESS-WORDS: func save(to: NSURL, forSaveOperation: Int)
216+
// CHECK-OMIT-NEEDLESS-WORDS: func bookmark(with: [URL])
217+
// CHECK-OMIT-NEEDLESS-WORDS: func save(to: URL, forSaveOperation: Int)
218+
// CHECK-OMIT-NEEDLESS-WORDS: func save(to: NSGUID, forSaveOperation: Int)
212219
// CHECK-OMIT-NEEDLESS-WORDS: func index(withItemNamed: String)
213220
// CHECK-OMIT-NEEDLESS-WORDS: func methodAndReturnError(_: AutoreleasingUnsafeMutablePointer<NSError?>!)
214221

test/IDE/print_omit_needless_words_appkit.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// REQUIRES: objc_interop
44
// REQUIRES: OS=macosx
55

6-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/ObjectiveC.swift
7-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/CoreGraphics.swift
8-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/Foundation.swift
9-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules-without-ns/AppKit.swift
6+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -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: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
8+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
9+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/AppKit.swift
1010

1111
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -print-module -source-filename %s -module-to-print=AppKit -function-definitions=false -prefer-type-repr=true -skip-parameter-names > %t.AppKit.txt
1212
// RUN: %FileCheck %s -check-prefix=CHECK-APPKIT -strict-whitespace < %t.AppKit.txt

test/Inputs/clang-importer-sdk/swift-modules-without-ns/AppKit.swift

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/Inputs/clang-importer-sdk/swift-modules-without-ns/CoreGraphics.swift

Lines changed: 0 additions & 48 deletions
This file was deleted.

test/Inputs/clang-importer-sdk/swift-modules-without-ns/Darwin.swift

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)