Tests for Cursor.dropFirst(_:)

This commit is contained in:
Gwendal Roué committed 2018-01-28 17:13:49 +01:00
1 parent 1e5caa62a8
commit 129e178ee0
1 file changed
+11
@@ -12,6 +12,17 @@ private struct TestError : Error { }
class DropFirstCursorTests: GRDBTestCase {
func testDropFirstCursorFromCursor() throws {
do {
let base = IteratorCursor([1, 2, 3, 4, 5])
let cursor = base.dropFirst(0)
try XCTAssertEqual(cursor.next()!, 1)
try XCTAssertEqual(cursor.next()!, 2)
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
}
do {
let base = IteratorCursor([1, 2, 3, 4, 5])
let cursor = base.dropFirst(2)