Skip to content

Commit 97ba30a

Browse files
authored
Fixing the omit_needless_words test. (swiftlang#4505)
AppKit apinotes do not get applied on anything other than macOS. This commit extracts the AppKit related part of the test into a separate file, in order to not restrict all other tests from being executed on simulators. <rdar://problem/27495329>
1 parent a240942 commit 97ba30a

File tree

2 files changed

+74
-66
lines changed

2 files changed

+74
-66
lines changed

test/IDE/print_omit_needless_words.swift

-66
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99
// 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
1010
// 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
1111

12-
// 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
13-
1412
// 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
1513
// RUN: %FileCheck %s -check-prefix=CHECK-OBJECTIVEC -strict-whitespace < %t.ObjectiveC.txt
1614

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

20-
// 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
21-
// RUN: %FileCheck %s -check-prefix=CHECK-APPKIT -strict-whitespace < %t.AppKit.txt
22-
2318
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t -I %S/../ClangModules/Inputs/custom-modules) -print-module -source-filename %s -module-to-print=CoreCooling -function-definitions=false -prefer-type-repr=true -skip-parameter-names > %t.CoreCooling.txt
2419
// RUN: %FileCheck %s -check-prefix=CHECK-CORECOOLING -strict-whitespace < %t.CoreCooling.txt
2520

@@ -196,73 +191,12 @@
196191
// CHECK-FOUNDATION: var NSTimeIntervalSince1970: Double { get }
197192
// CHECK-FOUNDATION: var NS_DO_SOMETHING: Int
198193

199-
// Note: class method name stripping context type.
200-
// CHECK-APPKIT: class func red() -> NSColor
201-
202-
// Note: instance method name stripping context type.
203-
// CHECK-APPKIT: func same() -> Self
204-
205-
// Note: Unsafe(Mutable)Pointers don't get defaulted to 'nil'
206-
// CHECK-APPKIT: func getRGBAComponents(_: UnsafeMutablePointer<Int8>?)
207-
208-
// Note: Skipping over "3D"
209-
// CHECK-APPKIT: func drawInAir(at: Point3D)
210-
211-
// Note: with<something> -> <something>
212-
// CHECK-APPKIT: func draw(at: Point3D, withAttributes: [String : Any]? = nil)
213-
214-
// Note: Don't strip names that aren't preceded by a verb or preposition.
215-
// CHECK-APPKIT: func setTextColor(_: NSColor?)
216-
217-
// Note: Splitting with default arguments.
218-
// CHECK-APPKIT: func draw(in: NSView?)
219-
220-
// Note: NSDictionary default arguments for "options"
221-
// CHECK-APPKIT: func drawAnywhere(in: NSView?, options: [AnyHashable : Any] = [:])
222-
// CHECK-APPKIT: func drawAnywhere(options: [AnyHashable : Any] = [:])
223-
// CHECK-APPKIT: func drawAnywhere(optionalOptions: [AnyHashable : Any]? = nil)
224-
225194
// Note: no lowercasing of initialisms when there might be a prefix.
226195
// CHECK-CORECOOLING: func CFBottom() ->
227196

228197
// Note: Skipping over "Ref"
229198
// CHECK-CORECOOLING: func replace(_: CCPowerSupply!)
230199

231-
// Make sure we're removing redundant context type info at both the
232-
// beginning and the end.
233-
// CHECK-APPKIT: func reversing() -> NSBezierPath
234-
235-
// Make sure we're dealing with 'instancetype' properly.
236-
// CHECK-APPKIT: func inventing() -> Self
237-
238-
// Make sure we're removing redundant context type info at both the
239-
// beginning and the end of a property.
240-
// CHECK-APPKIT: var flattened: NSBezierPath { get }
241-
242-
// CHECK-APPKIT: func dismiss(animated: Bool)
243-
244-
// CHECK-APPKIT: func shouldCollapseAutoExpandedItems(forDeposited: Bool) -> Bool
245-
246-
// Introducing argument labels and pruning the base name.
247-
// CHECK-APPKIT: func rectForCancelButton(whenCentered: Bool)
248-
249-
// CHECK-APPKIT: func openUntitledDocumentAndDisplay(_: Bool)
250-
251-
// Don't strip due to weak type information.
252-
// CHECK-APPKIT: func setContentHuggingPriority(_: NSLayoutPriority)
253-
254-
// Look through typedefs of pointers.
255-
// CHECK-APPKIT: func layout(at: NSPointPointer!)
256-
257-
// The presence of a property prevents us from stripping redundant
258-
// type information from the base name.
259-
// CHECK-APPKIT: func addGestureRecognizer(_: NSGestureRecognizer)
260-
// CHECK-APPKIT: func removeGestureRecognizer(_: NSGestureRecognizer)
261-
// CHECK-APPKIT: func favoriteView(for: NSGestureRecognizer) -> NSView?
262-
// CHECK-APPKIT: func addLayoutConstraints(_: Set<NSLayoutConstraint>)
263-
// CHECK-APPKIT: func add(_: NSRect)
264-
// CHECK-APPKIT: class func conjureRect(_: NSRect)
265-
266200
// CHECK-OMIT-NEEDLESS-WORDS: struct OMWWobbleOptions
267201
// CHECK-OMIT-NEEDLESS-WORDS: static var sideToSide: OMWWobbleOptions
268202
// CHECK-OMIT-NEEDLESS-WORDS: static var backAndForth: OMWWobbleOptions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
4+
// REQUIRES: objc_interop
5+
// REQUIRES: OS=macosx
6+
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
10+
// 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
11+
12+
// 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
13+
// RUN: %FileCheck %s -check-prefix=CHECK-APPKIT -strict-whitespace < %t.AppKit.txt
14+
15+
// Note: class method name stripping context type.
16+
// CHECK-APPKIT: class func red() -> NSColor
17+
18+
// Note: instance method name stripping context type.
19+
// CHECK-APPKIT: func same() -> Self
20+
21+
// Note: Unsafe(Mutable)Pointers don't get defaulted to 'nil'
22+
// CHECK-APPKIT: func getRGBAComponents(_: UnsafeMutablePointer<Int8>?)
23+
24+
// Note: Skipping over "3D"
25+
// CHECK-APPKIT: func drawInAir(at: Point3D)
26+
27+
// Note: with<something> -> <something>
28+
// CHECK-APPKIT: func draw(at: Point3D, withAttributes: [String : Any]? = nil)
29+
30+
// Note: Don't strip names that aren't preceded by a verb or preposition.
31+
// CHECK-APPKIT: func setTextColor(_: NSColor?)
32+
33+
// Note: Splitting with default arguments.
34+
// CHECK-APPKIT: func draw(in: NSView?)
35+
36+
// Note: NSDictionary default arguments for "options"
37+
// CHECK-APPKIT: func drawAnywhere(in: NSView?, options: [AnyHashable : Any] = [:])
38+
// CHECK-APPKIT: func drawAnywhere(options: [AnyHashable : Any] = [:])
39+
// CHECK-APPKIT: func drawAnywhere(optionalOptions: [AnyHashable : Any]? = nil)
40+
41+
// Make sure we're removing redundant context type info at both the
42+
// beginning and the end.
43+
// CHECK-APPKIT: func reversing() -> NSBezierPath
44+
45+
// Make sure we're dealing with 'instancetype' properly.
46+
// CHECK-APPKIT: func inventing() -> Self
47+
48+
// Make sure we're removing redundant context type info at both the
49+
// beginning and the end of a property.
50+
// CHECK-APPKIT: var flattened: NSBezierPath { get }
51+
52+
// CHECK-APPKIT: func dismiss(animated: Bool)
53+
54+
// CHECK-APPKIT: func shouldCollapseAutoExpandedItems(forDeposited: Bool) -> Bool
55+
56+
// Introducing argument labels and pruning the base name.
57+
// CHECK-APPKIT: func rectForCancelButton(whenCentered: Bool)
58+
59+
// CHECK-APPKIT: func openUntitledDocumentAndDisplay(_: Bool)
60+
61+
// Don't strip due to weak type information.
62+
// CHECK-APPKIT: func setContentHuggingPriority(_: NSLayoutPriority)
63+
64+
// Look through typedefs of pointers.
65+
// CHECK-APPKIT: func layout(at: NSPointPointer!)
66+
67+
// The presence of a property prevents us from stripping redundant
68+
// type information from the base name.
69+
// CHECK-APPKIT: func addGestureRecognizer(_: NSGestureRecognizer)
70+
// CHECK-APPKIT: func removeGestureRecognizer(_: NSGestureRecognizer)
71+
// CHECK-APPKIT: func favoriteView(for: NSGestureRecognizer) -> NSView?
72+
// CHECK-APPKIT: func addLayoutConstraints(_: Set<NSLayoutConstraint>)
73+
// CHECK-APPKIT: func add(_: NSRect)
74+
// CHECK-APPKIT: class func conjureRect(_: NSRect)

0 commit comments

Comments
 (0)