@@ -1637,6 +1637,7 @@ class DataTests : XCTestCase {
16371637 func test_InlineDataSpan( ) throws {
16381638 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
16391639
1640+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16401641 var source = Data ( )
16411642 var span = source. span
16421643 XCTAssertTrue ( span. isEmpty)
@@ -1646,15 +1647,18 @@ class DataTests : XCTestCase {
16461647 XCTAssertFalse ( span. isEmpty)
16471648 XCTAssertEqual ( span. count, source. count)
16481649 XCTAssertEqual ( span [ 0 ] , 1 )
1650+ #endif
16491651 }
16501652
16511653 func test_InlineSliceDataSpan( ) throws {
16521654 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
16531655
1656+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16541657 let source = Data ( 0 ... . max)
16551658 let span = source. span
16561659 XCTAssertEqual ( span. count, source. count)
16571660 XCTAssertEqual ( span [ span. indices. last!] , . max)
1661+ #endif
16581662 }
16591663
16601664 func test_LargeSliceDataSpan( ) throws {
@@ -1668,15 +1672,18 @@ class DataTests : XCTestCase {
16681672 #error("This test needs updating")
16691673#endif
16701674
1675+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16711676 let source = Data ( repeating: 0 , count: count) . dropFirst ( )
16721677 XCTAssertNotEqual ( source. startIndex, 0 )
16731678 let span = source. span
16741679 XCTAssertFalse ( span. isEmpty)
1680+ #endif
16751681 }
16761682
16771683 func test_InlineDataMutableSpan( ) throws {
16781684 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
16791685
1686+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16801687 var source = Data ( )
16811688 var span = source. mutableSpan
16821689 XCTAssertTrue ( span. isEmpty)
@@ -1690,18 +1697,21 @@ class DataTests : XCTestCase {
16901697 let v = UInt8 . random ( in: 10 ..< 100 )
16911698 span [ i] = v
16921699 XCTAssertEqual ( source [ i] , v)
1700+ #endif
16931701 }
16941702
16951703 func test_InlineSliceDataMutableSpan( ) throws {
16961704 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
16971705
1706+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
16981707 var source = Data ( 0 ..< 100 )
16991708 let count = source. count
17001709 var span = source. mutableSpan
17011710 XCTAssertEqual ( span. count, count)
17021711 let i = try XCTUnwrap ( span. indices. randomElement ( ) )
17031712 span [ i] = . max
17041713 XCTAssertEqual ( source [ i] , . max)
1714+ #endif
17051715 }
17061716
17071717 func test_LargeSliceDataMutableSpan( ) throws {
@@ -1715,6 +1725,7 @@ class DataTests : XCTestCase {
17151725 #error("This test needs updating")
17161726#endif
17171727
1728+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17181729 var source = Data ( repeating: 0 , count: count) . dropFirst ( )
17191730 XCTAssertNotEqual ( source. startIndex, 0 )
17201731 count = source. count
@@ -1724,11 +1735,13 @@ class DataTests : XCTestCase {
17241735 span [ i] = . max
17251736 XCTAssertEqual ( source [ i] , 0 )
17261737 XCTAssertEqual ( source [ i+ 1 ] , . max)
1738+ #endif
17271739 }
17281740
17291741 func test_InlineDataMutableRawSpan( ) throws {
17301742 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
17311743
1744+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17321745 var source = Data ( )
17331746 var span = source. mutableBytes
17341747 XCTAssertTrue ( span. isEmpty)
@@ -1742,18 +1755,21 @@ class DataTests : XCTestCase {
17421755 let v = UInt8 . random ( in: 10 ..< 100 )
17431756 span. storeBytes ( of: v, toByteOffset: i, as: UInt8 . self)
17441757 XCTAssertEqual ( source [ i] , v)
1758+ #endif
17451759 }
17461760
17471761 func test_InlineSliceDataMutableRawSpan( ) throws {
17481762 guard #available( FoundationSpan 6 . 2 , * ) else { throw XCTSkip ( " Span not available " ) }
17491763
1764+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17501765 var source = Data ( 0 ..< 100 )
17511766 let count = source. count
17521767 var span = source. mutableBytes
17531768 XCTAssertEqual ( span. byteCount, count)
17541769 let i = try XCTUnwrap ( span. byteOffsets. randomElement ( ) )
17551770 span. storeBytes ( of: - 1 , toByteOffset: i, as: Int8 . self)
17561771 XCTAssertEqual ( source [ i] , . max)
1772+ #endif
17571773 }
17581774
17591775 func test_LargeSliceDataMutableRawSpan( ) throws {
@@ -1767,6 +1783,7 @@ class DataTests : XCTestCase {
17671783 #error("This test needs updating")
17681784#endif
17691785
1786+ #if $InoutLifetimeDependence && $LifetimeDependenceMutableAccessors
17701787 var source = Data ( repeating: 0 , count: count) . dropFirst ( )
17711788 XCTAssertNotEqual ( source. startIndex, 0 )
17721789 count = source. count
@@ -1776,6 +1793,7 @@ class DataTests : XCTestCase {
17761793 span. storeBytes ( of: - 1 , toByteOffset: i, as: Int8 . self)
17771794 XCTAssertEqual ( source [ i] , 0 )
17781795 XCTAssertEqual ( source [ i+ 1 ] , . max)
1796+ #endif
17791797 }
17801798
17811799 #if false // FIXME: XCTest doesn't support crash tests yet rdar://20195010&22387653
0 commit comments