diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index 73d873020..1b053e258 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -9,8 +9,10 @@ class DatabaseMigratorTests : GRDBTestCase { try migrator.migrate(writer) } - #if canImport(Combine) func testEmptyMigratorSync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() try migrator.migrate(writer) @@ -19,9 +21,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorAsync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let expectation = self.expectation(description: "") let migrator = DatabaseMigrator() @@ -39,9 +45,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorPublisher() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() let publisher = migrator.migratePublisher(writer) @@ -52,9 +62,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorSync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -96,9 +110,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorAsync() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -147,9 +165,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorPublisher() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in @@ -199,9 +221,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testEmptyMigratorPublisherIsAsynchronous() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() let expectation = self.expectation(description: "") @@ -221,9 +247,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testNonEmptyMigratorPublisherIsAsynchronous() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -244,9 +274,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigratorPublisherDefaultScheduler() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: Writer) { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -269,9 +303,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigratorPublisherCustomScheduler() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: Writer) { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) @@ -295,9 +333,13 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } func testMigrateUpTo() throws { +#if !canImport(Combine) + throw XCTSkip("Combine not supported on this platform") +#else func test(writer: some DatabaseWriter) throws { var migrator = DatabaseMigrator() migrator.registerMigration("a") { db in @@ -346,9 +388,9 @@ class DatabaseMigratorTests : GRDBTestCase { try Test(test).run { try DatabaseQueue() } try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } +#endif } - #endif func testMigrationFailureTriggersRollback() throws { var migrator = DatabaseMigrator() migrator.registerMigration("createPersons") { db in