1
- // RUN: %target-run-simple-swift | %FileCheck %s
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-build-swift %s -o %t/a.out
3
+ // RUN: %target-codesign %t/a.out
4
+ // RUN: %target-run %t/a.out | grep 'check-prefix' > %t/prefix-option
5
+ // RUN: %target-run %t/a.out | %FileCheck -check-prefix=CHECK `cat %t/prefix-option` %s
2
6
// REQUIRES: executable_test
3
7
4
8
// REQUIRES: objc_interop
@@ -117,6 +121,16 @@ print("target removed")
117
121
// Test NSKeyValueObservingCustomization issue with observing from the callbacks
118
122
//===----------------------------------------------------------------------===//
119
123
124
+ // The following tests are only expected to pass when running with the
125
+ // Swift 5.1 and later libraries.
126
+ if #available( iOS 9999 , macOS 9999 , tvOS 9999 , watchOS 9999 , * ) {
127
+ print ( " -check-prefix=CHECK-51 " )
128
+ } else {
129
+ print ( " -check-prefix=DONT-CHECK " )
130
+ // Need at least one check, otherwise FileCheck will complain.
131
+ // DONT-CHECK: {{.}}
132
+ }
133
+
120
134
class Target2 : NSObject , NSKeyValueObservingCustomization {
121
135
@objc dynamic var name : String ?
122
136
@@ -151,10 +165,10 @@ withExtendedLifetime(Target2()) { (target) in
151
165
}
152
166
print ( " observer removed " )
153
167
154
- // CHECK-LABEL: registering observer for Target2
155
- // CHECK-DAG: keyPathsAffectingValue: key == \.name: true
156
- // CHECK-DAG: automaticallyNotifiesObservers: key == \.name: true
157
- // CHECK-NEXT: observer removed
168
+ // CHECK-51- LABEL: registering observer for Target2
169
+ // CHECK-51- DAG: keyPathsAffectingValue: key == \.name: true
170
+ // CHECK-51- DAG: automaticallyNotifiesObservers: key == \.name: true
171
+ // CHECK-51- NEXT: observer removed
158
172
159
173
//===----------------------------------------------------------------------===//
160
174
// Test NSSortDescriptor keyPath support
@@ -175,5 +189,5 @@ let descriptor = NSSortDescriptor(keyPath: \Sortable1.name, ascending: true)
175
189
_ = NSSortDescriptor ( keyPath: \Sortable2 . name, ascending: true )
176
190
print ( " keyPath == \\ Sortable1.name: " , descriptor. keyPath == \Sortable1 . name)
177
191
178
- // CHECK-LABEL: creating NSSortDescriptor
179
- // CHECK-NEXT: keyPath == \Sortable1.name: true
192
+ // CHECK-51- LABEL: creating NSSortDescriptor
193
+ // CHECK-51- NEXT: keyPath == \Sortable1.name: true
0 commit comments