mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Failing test for multiple check constraints on a column
This commit is contained in:
1 parent
0f2854fe17
commit
7bb5866164
1 file changed
+5
-3
@@ -125,17 +125,19 @@ class SQLTableBuilderTests: GRDBTestCase {
|
||||
try db.create(table: "test") { t in
|
||||
t.column("a", .Integer).check { $0 > 0 }
|
||||
t.column("b", .Integer).check(sql: "b <> 2")
|
||||
t.column("c", .Integer).check { $0 > 0 }.check { $0 < 10 }
|
||||
}
|
||||
XCTAssertEqual(self.lastSQLQuery,
|
||||
"CREATE TABLE \"test\" (" +
|
||||
"\"a\" INTEGER CHECK ((\"a\" > 0)), " +
|
||||
"\"b\" INTEGER CHECK (b <> 2)" +
|
||||
"\"b\" INTEGER CHECK (b <> 2), " +
|
||||
"\"c\" INTEGER CHECK ((\"c\" > 0)) CHECK ((\"c\" < 10))" +
|
||||
")")
|
||||
|
||||
// Sanity check
|
||||
try db.execute("INSERT INTO test (a, b) VALUES (1, 0)")
|
||||
try db.execute("INSERT INTO test (a, b, c) VALUES (1, 0, 1)")
|
||||
do {
|
||||
try db.execute("INSERT INTO test (a, b) VALUES (0, 0)")
|
||||
try db.execute("INSERT INTO test (a, b, c) VALUES (0, 0, 1)")
|
||||
XCTFail()
|
||||
} catch {
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user