Skip to content

Commit 389c3e0

Browse files
Tim De Jonggroue
authored andcommitted
Use #if !canImport(Combine) per test case (as done by @marcprux) and throw an XCTSkip for these test cases. This gives a better impression how many tests are skipped on Linux/non-Darwin platforms.
1 parent a212bf9 commit 389c3e0

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

Tests/GRDBTests/DatabaseMigratorTests.swift

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ class DatabaseMigratorTests : GRDBTestCase {
99
try migrator.migrate(writer)
1010
}
1111

12-
#if canImport(Combine)
1312
func testEmptyMigratorSync() throws {
13+
#if !canImport(Combine)
14+
throw XCTSkip("Combine not supported on this platform")
15+
#else
1416
func test(writer: some DatabaseWriter) throws {
1517
let migrator = DatabaseMigrator()
1618
try migrator.migrate(writer)
@@ -19,9 +21,13 @@ class DatabaseMigratorTests : GRDBTestCase {
1921
try Test(test).run { try DatabaseQueue() }
2022
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
2123
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
24+
#endif
2225
}
2326

2427
func testEmptyMigratorAsync() throws {
28+
#if !canImport(Combine)
29+
throw XCTSkip("Combine not supported on this platform")
30+
#else
2531
func test(writer: some DatabaseWriter) throws {
2632
let expectation = self.expectation(description: "")
2733
let migrator = DatabaseMigrator()
@@ -39,9 +45,13 @@ class DatabaseMigratorTests : GRDBTestCase {
3945
try Test(test).run { try DatabaseQueue() }
4046
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
4147
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
48+
#endif
4249
}
4350

4451
func testEmptyMigratorPublisher() throws {
52+
#if !canImport(Combine)
53+
throw XCTSkip("Combine not supported on this platform")
54+
#else
4555
func test(writer: some DatabaseWriter) throws {
4656
let migrator = DatabaseMigrator()
4757
let publisher = migrator.migratePublisher(writer)
@@ -52,9 +62,13 @@ class DatabaseMigratorTests : GRDBTestCase {
5262
try Test(test).run { try DatabaseQueue() }
5363
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
5464
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
65+
#endif
5566
}
5667

5768
func testNonEmptyMigratorSync() throws {
69+
#if !canImport(Combine)
70+
throw XCTSkip("Combine not supported on this platform")
71+
#else
5872
func test(writer: some DatabaseWriter) throws {
5973
var migrator = DatabaseMigrator()
6074
migrator.registerMigration("createPersons") { db in
@@ -96,9 +110,13 @@ class DatabaseMigratorTests : GRDBTestCase {
96110
try Test(test).run { try DatabaseQueue() }
97111
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
98112
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
113+
#endif
99114
}
100115

101116
func testNonEmptyMigratorAsync() throws {
117+
#if !canImport(Combine)
118+
throw XCTSkip("Combine not supported on this platform")
119+
#else
102120
func test(writer: some DatabaseWriter) throws {
103121
var migrator = DatabaseMigrator()
104122
migrator.registerMigration("createPersons") { db in
@@ -147,9 +165,13 @@ class DatabaseMigratorTests : GRDBTestCase {
147165
try Test(test).run { try DatabaseQueue() }
148166
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
149167
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
168+
#endif
150169
}
151170

152171
func testNonEmptyMigratorPublisher() throws {
172+
#if !canImport(Combine)
173+
throw XCTSkip("Combine not supported on this platform")
174+
#else
153175
func test(writer: some DatabaseWriter) throws {
154176
var migrator = DatabaseMigrator()
155177
migrator.registerMigration("createPersons") { db in
@@ -199,9 +221,13 @@ class DatabaseMigratorTests : GRDBTestCase {
199221
try Test(test).run { try DatabaseQueue() }
200222
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
201223
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
224+
#endif
202225
}
203226

204227
func testEmptyMigratorPublisherIsAsynchronous() throws {
228+
#if !canImport(Combine)
229+
throw XCTSkip("Combine not supported on this platform")
230+
#else
205231
func test(writer: some DatabaseWriter) throws {
206232
let migrator = DatabaseMigrator()
207233
let expectation = self.expectation(description: "")
@@ -221,9 +247,13 @@ class DatabaseMigratorTests : GRDBTestCase {
221247
try Test(test).run { try DatabaseQueue() }
222248
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
223249
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
250+
#endif
224251
}
225252

226253
func testNonEmptyMigratorPublisherIsAsynchronous() throws {
254+
#if !canImport(Combine)
255+
throw XCTSkip("Combine not supported on this platform")
256+
#else
227257
func test(writer: some DatabaseWriter) throws {
228258
var migrator = DatabaseMigrator()
229259
migrator.registerMigration("first", migrate: { _ in })
@@ -244,9 +274,13 @@ class DatabaseMigratorTests : GRDBTestCase {
244274
try Test(test).run { try DatabaseQueue() }
245275
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
246276
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
277+
#endif
247278
}
248279

249280
func testMigratorPublisherDefaultScheduler() throws {
281+
#if !canImport(Combine)
282+
throw XCTSkip("Combine not supported on this platform")
283+
#else
250284
func test<Writer: DatabaseWriter>(writer: Writer) {
251285
var migrator = DatabaseMigrator()
252286
migrator.registerMigration("first", migrate: { _ in })
@@ -269,9 +303,13 @@ class DatabaseMigratorTests : GRDBTestCase {
269303
try Test(test).run { try DatabaseQueue() }
270304
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
271305
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
306+
#endif
272307
}
273308

274309
func testMigratorPublisherCustomScheduler() throws {
310+
#if !canImport(Combine)
311+
throw XCTSkip("Combine not supported on this platform")
312+
#else
275313
func test<Writer: DatabaseWriter>(writer: Writer) {
276314
var migrator = DatabaseMigrator()
277315
migrator.registerMigration("first", migrate: { _ in })
@@ -295,9 +333,13 @@ class DatabaseMigratorTests : GRDBTestCase {
295333
try Test(test).run { try DatabaseQueue() }
296334
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
297335
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
336+
#endif
298337
}
299338

300339
func testMigrateUpTo() throws {
340+
#if !canImport(Combine)
341+
throw XCTSkip("Combine not supported on this platform")
342+
#else
301343
func test(writer: some DatabaseWriter) throws {
302344
var migrator = DatabaseMigrator()
303345
migrator.registerMigration("a") { db in
@@ -346,9 +388,9 @@ class DatabaseMigratorTests : GRDBTestCase {
346388
try Test(test).run { try DatabaseQueue() }
347389
try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) }
348390
try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) }
391+
#endif
349392
}
350393

351-
#endif
352394
func testMigrationFailureTriggersRollback() throws {
353395
var migrator = DatabaseMigrator()
354396
migrator.registerMigration("createPersons") { db in

0 commit comments

Comments
 (0)