Skip to content

Commit d463723

Browse files
committed
[test] guard a behavioral change
These two edge cases were fixed in swiftlang#71369, and fail when run against an older standard library. Ensure they run only against a Swift 6.0 or newer stdlib Addresses rdar://123810713
1 parent 52c1f50 commit d463723

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/stdlib/Integers.swift.gyb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,12 @@ tests.test("Strideable") {
852852
expectEqual(dist(UInt8.max, UInt8.min), -255)
853853
expectEqual(dist(Int8.min, Int8.max), 255)
854854
expectEqual(dist(Int8.max, Int8.min), -255)
855-
856-
expectEqual(Int8.min.advanced(by: Int(Int8.max)+1), 0)
857-
expectEqual(UInt.max.advanced(by: Int.min), UInt.max / 2)
855+
856+
if #available(SwiftStdlib 6.0, *) {
857+
// Edge cases fixed in Swift 6.0
858+
expectEqual(Int8.min.advanced(by: Int(Int8.max)+1), 0)
859+
expectEqual(UInt.max.advanced(by: Int.min), UInt.max / 2)
860+
}
858861
}
859862

860863
tests.test("signum/generic") {

0 commit comments

Comments
 (0)