@@ -2112,6 +2112,11 @@ public final class TestSuite {
2112
2112
return self
2113
2113
}
2114
2114
2115
+ public func require( _ stdlibVersion: StdLibVersion ) -> _TestBuilder {
2116
+ _data. _skip. append ( . minimumStdlib( stdlibVersion) )
2117
+ return self
2118
+ }
2119
+
2115
2120
public func stdin( _ stdinText: String , eof: Bool = false ) -> _TestBuilder {
2116
2121
_data. _stdinText = stdinText
2117
2122
_data. _stdinEndsWithEOF = eof
@@ -2203,6 +2208,35 @@ func _getSystemVersionPlistProperty(_ propertyName: String) -> String? {
2203
2208
#endif
2204
2209
#endif
2205
2210
2211
+ public enum StdLibVersion : String {
2212
+ case stdlib_5_7 = " 5.7 "
2213
+ case stdlib_5_8 = " 5.8 "
2214
+ case stdlib_5_9 = " 5.9 "
2215
+ case stdlib_5_10 = " 5.10 "
2216
+ case stdlib_6_0 = " 6.0 "
2217
+ case stdlib_6_1 = " 6.1 "
2218
+ case stdlib_6_2 = " 6.2 "
2219
+
2220
+ var isAvailable : Bool {
2221
+ switch self {
2222
+ case . stdlib_5_7:
2223
+ return if #available( SwiftStdlib 5 . 7 , * ) { true } else { false }
2224
+ case . stdlib_5_8:
2225
+ return if #available( SwiftStdlib 5 . 8 , * ) { true } else { false }
2226
+ case . stdlib_5_9:
2227
+ return if #available( SwiftStdlib 5 . 9 , * ) { true } else { false }
2228
+ case . stdlib_5_10:
2229
+ return if #available( SwiftStdlib 5 . 10 , * ) { true } else { false }
2230
+ case . stdlib_6_0:
2231
+ return if #available( SwiftStdlib 6 . 0 , * ) { true } else { false }
2232
+ case . stdlib_6_1:
2233
+ return if #available( SwiftStdlib 6 . 1 , * ) { true } else { false }
2234
+ case . stdlib_6_2:
2235
+ return if #available( SwiftStdlib 6 . 2 , * ) { true } else { false }
2236
+ }
2237
+ }
2238
+ }
2239
+
2206
2240
public enum OSVersion : CustomStringConvertible {
2207
2241
case osx( major: Int , minor: Int , bugFix: Int )
2208
2242
case iOS( major: Int , minor: Int , bugFix: Int )
@@ -2413,6 +2447,8 @@ public enum TestRunPredicate : CustomStringConvertible {
2413
2447
case objCRuntime( /*reason:*/ String )
2414
2448
case nativeRuntime( /*reason:*/ String )
2415
2449
2450
+ case minimumStdlib( StdLibVersion )
2451
+
2416
2452
public var description : String {
2417
2453
switch self {
2418
2454
case . custom( _, let reason) :
@@ -2533,6 +2569,9 @@ public enum TestRunPredicate : CustomStringConvertible {
2533
2569
return " Objective-C runtime, reason: \( reason) ) "
2534
2570
case . nativeRuntime( let reason) :
2535
2571
return " Native runtime (no ObjC), reason: \( reason) ) "
2572
+
2573
+ case . minimumStdlib( let version) :
2574
+ return " Requires Swift \( version. rawValue) 's standard library "
2536
2575
}
2537
2576
}
2538
2577
@@ -2921,6 +2960,9 @@ public enum TestRunPredicate : CustomStringConvertible {
2921
2960
#else
2922
2961
return true
2923
2962
#endif
2963
+
2964
+ case . minimumStdlib( let version) :
2965
+ return !version. isAvailable
2924
2966
}
2925
2967
}
2926
2968
}
0 commit comments