Skip to content

Commit 1202f28

Browse files
committed
Fix test failure
1 parent c100157 commit 1202f28

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Tests/FoundationEssentialsTests/DataTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,13 +2473,16 @@ struct LargeDataTests {
24732473
}
24742474

24752475
@Test func validateMutation_cow_largeMutableBytes() {
2476+
// Avoid copying a large data on platforms with constrained memory limits
2477+
#if !canImport(Darwin) || os(macOS)
24762478
var data = Data(count: largeCount)
24772479
let heldData = data
24782480
var bytes = data.mutableBytes
24792481
bytes.storeBytes(of: 1, toByteOffset: 0, as: UInt8.self)
24802482

24812483
#expect(data[0] == 1)
24822484
#expect(heldData[0] == 0)
2485+
#endif
24832486

24842487
var data2 = Data(count: largeCount)
24852488
// Escape the pointer to compare after a mutation without dereferencing the pointer
@@ -2494,13 +2497,16 @@ struct LargeDataTests {
24942497
}
24952498

24962499
@Test func validateMutation_cow_largeMutableSpan() {
2500+
// Avoid copying a large data on platforms with constrained memory limits
2501+
#if !canImport(Darwin) || os(macOS)
24972502
var data = Data(count: largeCount)
24982503
let heldData = data
24992504
var bytes = data.mutableSpan
25002505
bytes[0] = 1
25012506

25022507
#expect(data[0] == 1)
25032508
#expect(heldData[0] == 0)
2509+
#endif
25042510

25052511
var data2 = Data(count: largeCount)
25062512
// Escape the pointer to compare after a mutation without dereferencing the pointer

0 commit comments

Comments
 (0)