mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Test In-memory Database
This commit is contained in:
1 parent
449042d62e
commit
640b8dc60e
1 file changed
+26
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// InMemoryDatabaseTests.swift
|
||||
// GRDB
|
||||
//
|
||||
// Created by Gwendal Roué on 04/07/2015.
|
||||
// Copyright © 2015 Gwendal Roué. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class InMemoryDatabaseTests : GRDBTestCase
|
||||
{
|
||||
func testInMemoryDatabase() {
|
||||
assertNoError {
|
||||
let dbQueue = try DatabaseQueue()
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute("CREATE TABLE foo (bar TEXT)")
|
||||
try db.execute("INSERT INTO foo (bar) VALUES ('baz')")
|
||||
let baz = db.fetchOne(String.self, "SELECT bar FROM foo")!
|
||||
XCTAssertEqual(baz, "baz")
|
||||
return .Rollback
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user