From 3c4ff5b26eab63fa4cf7aaa182ed53fafb9ba823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 20 Oct 2022 08:31:40 +0200 Subject: [PATCH] Single test for strict tables Also, skip the test for old SQLCipher version. --- Tests/GRDBTests/TableDefinitionTests.swift | 38 ++++++---------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/Tests/GRDBTests/TableDefinitionTests.swift b/Tests/GRDBTests/TableDefinitionTests.swift index ed7ac3db6..a63deb9a2 100644 --- a/Tests/GRDBTests/TableDefinitionTests.swift +++ b/Tests/GRDBTests/TableDefinitionTests.swift @@ -46,34 +46,16 @@ class TableDefinitionTests: GRDBTestCase { } } -#if GRDBCUSTOMSQLITE || GRDBCIPHER - func testStrictTableCreationOptionCustomAndCipher() throws { - let dbQueue = try makeDatabaseQueue() - try dbQueue.inDatabase { db in - try db.create(table: "test3", options: [.strict]) { t in - t.column("id", .integer).primaryKey() - t.column("a", .integer) - t.column("b", .real) - t.column("c", .text) - t.column("d", .blob) - t.column("e", .any) - } - assertEqualSQL(lastSQLQuery!, """ - CREATE TABLE "test3" (\ - "id" INTEGER PRIMARY KEY, \ - "a" INTEGER, \ - "b" REAL, \ - "c" TEXT, \ - "d" BLOB, \ - "e" ANY\ - ) STRICT - """) - } - } -#endif - - @available(iOS 15.4, macOS 12.4, tvOS 15.4, watchOS 8.5, *) func testStrictTableCreationOption() throws { + guard sqlite3_libversion_number() >= 3037000 else { + throw XCTSkip("STRICT tables are not available") + } + #if !GRDBCUSTOMSQLITE && !GRDBCIPHER + guard #available(iOS 15.4, macOS 12.4, tvOS 15.4, watchOS 8.5, *) else { + throw XCTSkip("STRICT tables are not available") + } + #endif + let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.create(table: "test3", options: [.strict]) { t in @@ -96,7 +78,7 @@ class TableDefinitionTests: GRDBTestCase { """) } } - + func testColumnLiteral() throws { let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in