From 129e178ee027ce16e3071920f0af52833eaa21f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 28 Jan 2018 14:53:39 +0100 Subject: [PATCH] Tests for Cursor.dropFirst(_:) --- Tests/GRDBTests/DropFirstCursorTests.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/GRDBTests/DropFirstCursorTests.swift b/Tests/GRDBTests/DropFirstCursorTests.swift index d118418da..96edcdc3d 100644 --- a/Tests/GRDBTests/DropFirstCursorTests.swift +++ b/Tests/GRDBTests/DropFirstCursorTests.swift @@ -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)