From 009dc6c9cd0298f41c7913fe9675b85bb0d7e437 Mon Sep 17 00:00:00 2001 From: Jasdev Singh Date: Mon, 25 Jan 2021 16:21:48 -0500 Subject: [PATCH] =?UTF-8?q?`Zip*`=20=E2=87=92=20`Take*`.=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * `Zip*` ⇒ `Take*`. * Fixes example in `Parser.take(_:)`’s docs. --- Sources/Parsing/Parsers/{Zip.swift => Take.swift} | 3 ++- Tests/ParsingTests/{ZipTests.swift => TakeTests.swift} | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) rename Sources/Parsing/Parsers/{Zip.swift => Take.swift} (98%) rename Tests/ParsingTests/{ZipTests.swift => TakeTests.swift} (96%) diff --git a/Sources/Parsing/Parsers/Zip.swift b/Sources/Parsing/Parsers/Take.swift similarity index 98% rename from Sources/Parsing/Parsers/Zip.swift rename to Sources/Parsing/Parsers/Take.swift index 38f20eaa2a..f41d891d61 100644 --- a/Sources/Parsing/Parsers/Zip.swift +++ b/Sources/Parsing/Parsers/Take.swift @@ -13,7 +13,8 @@ extension Parser { /// var input = "-1.5,1"[...].utf8 /// let output = Double.parser() /// .skip(StartsWith(",")) - /// .take(CGPoint.parser()) + /// .take(Double.parser()) + /// .map(Point.init) /// .parse(&input) // => Point(x: -1.5, y: 1) /// precondition(Substring(input) == "") /// diff --git a/Tests/ParsingTests/ZipTests.swift b/Tests/ParsingTests/TakeTests.swift similarity index 96% rename from Tests/ParsingTests/ZipTests.swift rename to Tests/ParsingTests/TakeTests.swift index 15ccf323b2..6da70318ad 100644 --- a/Tests/ParsingTests/ZipTests.swift +++ b/Tests/ParsingTests/TakeTests.swift @@ -1,7 +1,7 @@ import Parsing import XCTest -final class ZipTests: XCTestCase { +final class TakeTests: XCTestCase { func testTake2Success() { var input = "12345"[...] XCTAssert(try ("1", "2") == XCTUnwrap(First().take(First()).parse(&input)))