mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
Tests for Cursor.dropFirst(_:)
This commit is contained in:
1 parent
72608fd016
commit
520bdd64e6
2 files changed
+11
-2
No files matched your search
@@ -177,8 +177,6 @@ extension Cursor {
|
||||
/// - Returns: A cursor starting after the specified number of
|
||||
/// elements.
|
||||
public func dropFirst(_ n: Int) -> DropFirstCursor<Self> {
|
||||
// TODO: test that [1,2,3,4].dropFirst(1).dropFirst(1) is equivalent to
|
||||
// [1,2,3,4].dropFirst(2).
|
||||
return DropFirstCursor(self, limit: n)
|
||||
}
|
||||
|
||||
|
||||
@@ -47,4 +47,15 @@ class DropFirstCursorTests: GRDBTestCase {
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
|
||||
func testDropFirstChain() throws {
|
||||
let base = IteratorCursor([1, 2, 3, 4, 5])
|
||||
let cursor = base.dropFirst(1).dropFirst(1)
|
||||
try XCTAssertEqual(cursor.next()!, 3)
|
||||
try XCTAssertEqual(cursor.next()!, 4)
|
||||
try XCTAssertEqual(cursor.next()!, 5)
|
||||
XCTAssertTrue(try cursor.next() == nil) // end
|
||||
XCTAssertTrue(try cursor.next() == nil) // past the end
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user