@@ -1637,7 +1637,6 @@ class DataTests : XCTestCase {
1637
1637
func test_InlineDataSpan( ) throws {
1638
1638
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1639
1639
1640
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1641
1640
var source = Data ( )
1642
1641
var span = source. span
1643
1642
XCTAssertTrue ( span. isEmpty)
@@ -1647,18 +1646,15 @@ class DataTests : XCTestCase {
1647
1646
XCTAssertFalse ( span. isEmpty)
1648
1647
XCTAssertEqual ( span. count, source. count)
1649
1648
XCTAssertEqual ( span [ 0 ] , 1 )
1650
- #endif
1651
1649
}
1652
1650
1653
1651
func test_InlineSliceDataSpan( ) throws {
1654
1652
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1655
1653
1656
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1657
1654
let source = Data ( 0 ... . max)
1658
1655
let span = source. span
1659
1656
XCTAssertEqual ( span. count, source. count)
1660
1657
XCTAssertEqual ( span [ span. indices. last!] , . max)
1661
- #endif
1662
1658
}
1663
1659
1664
1660
func test_LargeSliceDataSpan( ) throws {
@@ -1672,19 +1668,16 @@ class DataTests : XCTestCase {
1672
1668
#error("This test needs updating")
1673
1669
#endif
1674
1670
1675
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1676
1671
let source = Data ( repeating: 0 , count: count) . dropFirst ( )
1677
1672
XCTAssertNotEqual ( source. startIndex, 0 )
1678
1673
let span = source. span
1679
1674
XCTAssertFalse ( span. isEmpty)
1680
- #endif
1681
1675
}
1682
1676
1683
1677
func test_InlineDataMutableSpan( ) throws {
1684
1678
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1685
1679
1686
1680
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1687
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1688
1681
var source = Data ( )
1689
1682
var span = source. mutableSpan
1690
1683
XCTAssertTrue ( span. isEmpty)
@@ -1700,15 +1693,13 @@ class DataTests : XCTestCase {
1700
1693
var sub = span. extracting ( i ..< i+ 1 )
1701
1694
sub. update ( repeating: v)
1702
1695
XCTAssertEqual ( source [ i] , v)
1703
- #endif
1704
1696
#endif
1705
1697
}
1706
1698
1707
1699
func test_InlineSliceDataMutableSpan( ) throws {
1708
1700
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1709
1701
1710
1702
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1711
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1712
1703
var source = Data ( 0 ..< 100 )
1713
1704
let count = source. count
1714
1705
var span = source. mutableSpan
@@ -1717,7 +1708,6 @@ class DataTests : XCTestCase {
1717
1708
var sub = span. extracting ( i..< i+ 1 )
1718
1709
sub. update ( repeating: . max)
1719
1710
XCTAssertEqual ( source [ i] , . max)
1720
- #endif
1721
1711
#endif
1722
1712
}
1723
1713
@@ -1733,7 +1723,6 @@ class DataTests : XCTestCase {
1733
1723
#endif
1734
1724
1735
1725
#if !canImport(Darwin) || FOUNDATION_FRAMEWORK
1736
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1737
1726
var source = Data ( repeating: 0 , count: count) . dropFirst ( )
1738
1727
XCTAssertNotEqual ( source. startIndex, 0 )
1739
1728
count = source. count
@@ -1743,14 +1732,12 @@ class DataTests : XCTestCase {
1743
1732
span [ i] = . max
1744
1733
XCTAssertEqual ( source [ i] , 0 )
1745
1734
XCTAssertEqual ( source [ i+ 1 ] , . max)
1746
- #endif
1747
1735
#endif
1748
1736
}
1749
1737
1750
1738
func test_InlineDataMutableRawSpan( ) throws {
1751
1739
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1752
1740
1753
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1754
1741
var source = Data ( )
1755
1742
var span = source. mutableBytes
1756
1743
XCTAssertTrue ( span. isEmpty)
@@ -1765,21 +1752,18 @@ class DataTests : XCTestCase {
1765
1752
var sub = span. extracting ( i..< i+ 1 )
1766
1753
sub. storeBytes ( of: v, as: UInt8 . self)
1767
1754
XCTAssertEqual ( source [ i] , v)
1768
- #endif
1769
1755
}
1770
1756
1771
1757
func test_InlineSliceDataMutableRawSpan( ) throws {
1772
1758
guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
1773
1759
1774
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1775
1760
var source = Data ( 0 ..< 100 )
1776
1761
let count = source. count
1777
1762
var span = source. mutableBytes
1778
1763
XCTAssertEqual ( span. byteCount, count)
1779
1764
let i = try XCTUnwrap ( span. byteOffsets. randomElement ( ) )
1780
1765
span. storeBytes ( of: - 1 , toByteOffset: i, as: Int8 . self)
1781
1766
XCTAssertEqual ( source [ i] , . max)
1782
- #endif
1783
1767
}
1784
1768
1785
1769
func test_LargeSliceDataMutableRawSpan( ) throws {
@@ -1793,7 +1777,6 @@ class DataTests : XCTestCase {
1793
1777
#error("This test needs updating")
1794
1778
#endif
1795
1779
1796
- #if compiler(>=6.2) && $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
1797
1780
var source = Data ( repeating: 0 , count: count) . dropFirst ( )
1798
1781
XCTAssertNotEqual ( source. startIndex, 0 )
1799
1782
count = source. count
@@ -1803,7 +1786,6 @@ class DataTests : XCTestCase {
1803
1786
span. storeBytes ( of: - 1 , toByteOffset: i, as: Int8 . self)
1804
1787
XCTAssertEqual ( source [ i] , 0 )
1805
1788
XCTAssertEqual ( source [ i+ 1 ] , . max)
1806
- #endif
1807
1789
}
1808
1790
1809
1791
#if false // FIXME: XCTest doesn't support crash tests yet rdar://20195010&22387653
0 commit comments