From 0b9f7f5ea2324bc75469855a5a6d37c2affa6cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Sur=C3=A9e?= Date: Mon, 19 Feb 2018 13:59:55 +0100 Subject: [PATCH] Bump fs2 to 0.10.2 (#54) --- build.sbt | 2 +- core/src/test/scala/ServerSentEventsTests.scala | 8 ++++---- core/src/test/scala/ServerTests.scala | 4 ++-- core/src/test/scala/Tests.scala | 2 +- json/src/test/scala/JsonTests.scala | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index 4b983ef..83a0770 100644 --- a/build.sbt +++ b/build.sbt @@ -93,7 +93,7 @@ lazy val lolhttp = commonSettings, libraryDependencies ++= Seq( - "co.fs2" %% "fs2-core" % "0.10.1", + "co.fs2" %% "fs2-core" % "0.10.2", "io.netty" % "netty-codec-http2" % "4.1.16.Final", "org.scalatest" %% "scalatest" % "3.0.4" % "test" ), diff --git a/core/src/test/scala/ServerSentEventsTests.scala b/core/src/test/scala/ServerSentEventsTests.scala index 8dcf484..df2901f 100644 --- a/core/src/test/scala/ServerSentEventsTests.scala +++ b/core/src/test/scala/ServerSentEventsTests.scala @@ -26,7 +26,7 @@ class ServerSentEventsTests extends Tests { Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client => client.run(Get("/stream")) { response => response.readAs[Stream[IO,Event[String]]].flatMap { eventStream => - eventStream.runLog.map(_.toList) + eventStream.compile.toVector.map(_.toList) } } } @@ -54,7 +54,7 @@ class ServerSentEventsTests extends Tests { timeout(client.stopSync(), 1.second).unsafeRunAsync(_ => ()) client.run(Get("/streamThatSendsNothing")) { response => response.readAs[Stream[IO,Event[String]]].flatMap { eventStream => - eventStream.runLog.map { e => + eventStream.compile.toVector.map { e => e.toList } } @@ -76,7 +76,7 @@ class ServerSentEventsTests extends Tests { Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client => client.run(Get("/")) { response => response.readAs[Stream[IO,Event[String]]].flatMap { eventStream => - eventStream.runLog.map(_.toList) + eventStream.compile.toVector.map(_.toList) } } } @@ -92,7 +92,7 @@ class ServerSentEventsTests extends Tests { Client("localhost", server.port, options = ClientOptions(protocols = Set(protocol))).runAndStop { client => client.run(Get("/fakeStream")) { response => response.readAs[Stream[IO,Event[String]]].flatMap { eventStream => - eventStream.runLog.map(_.toList) + eventStream.compile.toVector.map(_.toList) } } } diff --git a/core/src/test/scala/ServerTests.scala b/core/src/test/scala/ServerTests.scala index 64e98b7..3618a8e 100644 --- a/core/src/test/scala/ServerTests.scala +++ b/core/src/test/scala/ServerTests.scala @@ -141,11 +141,11 @@ class ServerTests extends Tests { foreachProtocol(HTTP, HTTP2) { protocol => withServer(Server.listen(options = ServerOptions(protocols = Set(protocol))) { case req @ POST at url"/" => - req.read(_.chunks.runFold(0)((size,chunk) => size + chunk.size)).map { contentSize => + req.read(_.chunks.compile.fold(0)((size,chunk) => size + chunk.size)).map { contentSize => Ok(s"Received $contentSize bytes") } case req @ POST at url"/take/$size" => - req.read(_.take(size.toInt).chunks.runFold(0)((size,chunk) => size + chunk.size)).map { contentSize => + req.read(_.take(size.toInt).chunks.compile.fold(0)((size,chunk) => size + chunk.size)).map { contentSize => Ok(s"Took $contentSize bytes") } }) { server => diff --git a/core/src/test/scala/Tests.scala b/core/src/test/scala/Tests.scala index a6d74dc..9a779e3 100644 --- a/core/src/test/scala/Tests.scala +++ b/core/src/test/scala/Tests.scala @@ -24,7 +24,7 @@ abstract class Tests extends FunSuite with Matchers with OptionValues with Insid await(atMost) { Client.run(req, timeout = atMost, options = ClientOptions(protocols = Set(protocol)))(res => IO.pure(res.headers)) } } def getString(content: Content, codec: String = "utf-8") = new String(getBytes(content).toArray, codec) - def getBytes(content: Content): Vector[Byte] = content.stream.runLog.unsafeRunSync() + def getBytes(content: Content): Vector[Byte] = content.stream.compile.toVector.unsafeRunSync() def bytes(data: Int*): Seq[Byte] = data.map(_.toByte) def eventually[A](assertion: => A, timeout: FiniteDuration = 5.seconds): A = { val start = System.currentTimeMillis diff --git a/json/src/test/scala/JsonTests.scala b/json/src/test/scala/JsonTests.scala index 68cf2c1..6bb8658 100644 --- a/json/src/test/scala/JsonTests.scala +++ b/json/src/test/scala/JsonTests.scala @@ -106,7 +106,7 @@ class JsonTests extends Tests { Client("localhost", server.port).runAndStop { client => client.run(Get("/stream")) { response => response.readAs[Stream[IO,Event[Json]]].flatMap { eventStream => - eventStream.runLog.map(_.toList) + eventStream.compile.toVector.map(_.toList) } } }