Skip to content

Commit 77a1f8f

Browse files
committed
Fix Ubuntu CI build by replacing autoreleasepool with do blocks
Replace autoreleasepool blocks with do blocks in SubgraphCompatibilityTests to fix build failures on Ubuntu/Linux where autoreleasepool is not available (Darwin-only feature). The do blocks maintain the same scoping behavior needed for the tests while being cross-platform compatible.
1 parent aebb6e1 commit 77a1f8f

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Tests/OpenAttributeGraphCompatibilityTests/Graph/SubgraphCompatibilityTests.swift

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,53 +34,46 @@ struct SubgraphCompatibilityTests {
3434
@Test
3535
func observerNotifiedOnSubgraphDestroyed() {
3636
var notifiedCount = 0
37-
autoreleasepool {
37+
do {
3838
let graph = Graph()
39-
40-
autoreleasepool {
39+
do {
4140
let subgraph = Subgraph(graph: graph)
4241
let _ = subgraph.addObserver {
4342
notifiedCount += 1
4443
}
4544
}
46-
4745
#expect(notifiedCount == 1)
4846
}
49-
5047
// Observers aren't notified more than once
5148
#expect(notifiedCount == 1)
5249
}
5350

5451
@Test
5552
func observerNotifiedOnGraphDestroyed() {
5653
var notifiedCount = 0
57-
autoreleasepool {
54+
do {
5855
let graph = Graph()
5956
let subgraph = Subgraph(graph: graph)
6057
let _ = subgraph.addObserver {
6158
notifiedCount += 1
6259
}
63-
6460
#expect(notifiedCount == 0)
6561
}
66-
6762
#expect(notifiedCount == 1)
6863
}
6964

7065
@Test
7166
func removedObserverNotNotified() {
7267
var notifiedCount = 0
73-
autoreleasepool {
68+
do {
7469
let graph = Graph()
7570
let subgraph = Subgraph(graph: graph)
7671
let observerID = subgraph.addObserver {
7772
notifiedCount += 1
7873
}
7974
subgraph.removeObserver(observerID)
8075
}
81-
8276
#expect(notifiedCount == 0)
8377
}
84-
8578
}
8679
}

0 commit comments

Comments
 (0)