@@ -2112,6 +2112,11 @@ public final class TestSuite {
21122112 return self
21132113 }
21142114
2115+ public func require( _ stdlibVersion: StdLibVersion ) -> _TestBuilder {
2116+ _data. _skip. append ( . minimumStdlib( stdlibVersion) )
2117+ return self
2118+ }
2119+
21152120 public func stdin( _ stdinText: String , eof: Bool = false ) -> _TestBuilder {
21162121 _data. _stdinText = stdinText
21172122 _data. _stdinEndsWithEOF = eof
@@ -2203,6 +2208,35 @@ func _getSystemVersionPlistProperty(_ propertyName: String) -> String? {
22032208#endif
22042209#endif
22052210
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+
22062240public enum OSVersion : CustomStringConvertible {
22072241 case osx( major: Int , minor: Int , bugFix: Int )
22082242 case iOS( major: Int , minor: Int , bugFix: Int )
@@ -2413,6 +2447,8 @@ public enum TestRunPredicate : CustomStringConvertible {
24132447 case objCRuntime( /*reason:*/ String )
24142448 case nativeRuntime( /*reason:*/ String )
24152449
2450+ case minimumStdlib( StdLibVersion )
2451+
24162452 public var description : String {
24172453 switch self {
24182454 case . custom( _, let reason) :
@@ -2533,6 +2569,9 @@ public enum TestRunPredicate : CustomStringConvertible {
25332569 return " Objective-C runtime, reason: \( reason) ) "
25342570 case . nativeRuntime( let reason) :
25352571 return " Native runtime (no ObjC), reason: \( reason) ) "
2572+
2573+ case . minimumStdlib( let version) :
2574+ return " Requires Swift \( version. rawValue) 's standard library "
25362575 }
25372576 }
25382577
@@ -2921,6 +2960,9 @@ public enum TestRunPredicate : CustomStringConvertible {
29212960#else
29222961 return true
29232962#endif
2963+
2964+ case . minimumStdlib( let version) :
2965+ return !version. isAvailable
29242966 }
29252967 }
29262968}
0 commit comments