#147: tests for QueryInterfaceRequest.fetchCursor(_:) and (RowConvertible & TableMapping).fetchCursor(_:)

This commit is contained in:
Gwendal Roué committed 2016-11-26 11:20:35 +01:00
1 parent 1aeb6d0d9e
commit a548212f27
3 files changed
+14 -2

No files matched your search

@@ -32,7 +32,6 @@ extension QueryInterfaceRequest where T: RowConvertible {
/// TODO
public func fetchCursor(_ db: Database) throws -> DatabaseCursor<T> {
// TODO: test
return try T.fetchCursor(db, self)
}
@@ -491,7 +490,6 @@ extension RowConvertible where Self: TableMapping {
/// TODO
public static func fetchCursor(_ db: Database) throws -> DatabaseCursor<Self> {
// TODO: test
return try all().fetchCursor(db)
}
@@ -94,6 +94,13 @@ class RecordQueryInterfaceRequestTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"readers\"")
XCTAssertEqual(names, [arthur.name, barbara.name])
}
do {
let cursor = try request.fetchCursor(db)
let names = try cursor.map { $0.name }
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"readers\"")
XCTAssertEqual(names, [arthur.name, barbara.name])
}
}
}
}
@@ -140,6 +140,13 @@ class RowConvertibleQueryInterfaceRequestTests: GRDBTestCase {
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"readers\"")
XCTAssertEqual(names, [arthur.name, barbara.name])
}
do {
let cursor = try Reader.fetchCursor(db)
let names = try cursor.map { $0.name }
XCTAssertEqual(lastSQLQuery, "SELECT * FROM \"readers\"")
XCTAssertEqual(names, [arthur.name, barbara.name])
}
}
}
}