Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump circe to 0.11.0 #47

Merged
merged 3 commits into from
Jan 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ val compilerOptions = Seq(
"-Xfuture"
)

val circeVersion = "0.10.1"
val circeVersion = "0.11.0"
val fs2Version = "1.0.2"
val previousCirceFs2Version = "0.9.0"
val previousCirceFs2Version = "0.10.0"

val baseSettings = Seq(
scalacOptions ++= compilerOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/circe/fs2/ParsingPipe.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.circe.fs2

import _root_.fs2.{ Chunk, Pipe, Pull, RaiseThrowable, Stream }
import _root_.jawn.{ AsyncParser, ParseException }
import io.circe.{ Json, ParsingFailure }
import io.circe.jawn.CirceSupportParser
import org.typelevel.jawn.{ AsyncParser, ParseException }

private[fs2] abstract class ParsingPipe[F[_], S] extends Pipe[F, S, Json] {
protected[this] val raiseThrowable: RaiseThrowable[F]
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/circe/fs2/package.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.circe

import _root_.fs2.{Chunk, Pipe, RaiseThrowable, Stream}
import _root_.jawn.{AsyncParser, ParseException}
import io.circe.jawn.CirceSupportParser
import org.typelevel.jawn.{AsyncParser, ParseException}

package object fs2 {
final def stringArrayParser[F[_] : RaiseThrowable]: Pipe[F, String, Json] = stringParser(AsyncParser.UnwrapArray)
Expand Down
37 changes: 2 additions & 35 deletions src/test/scala/io/circe/fs2/Fs2Suite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package io.circe.fs2

import _root_.fs2.{ Pipe, Stream, text }
import cats.effect.IO
import io.circe.{ DecodingFailure, Json, ParsingFailure }
import io.circe.{ DecodingFailure, Json }
import io.circe.fs2.examples._
import io.circe.generic.auto._
import io.circe.syntax._
import jawn.AsyncParser
import org.typelevel.jawn.AsyncParser
import scala.collection.immutable.{Stream => StdStream}

class Fs2Suite extends CirceSuite {
Expand Down Expand Up @@ -87,30 +87,6 @@ class Fs2Suite extends CirceSuite {
.compile.toVector.attempt.unsafeRunSync() === Right(foos.toVector))
}

"stringArrayParser" should "return ParsingFailure" in {
testParsingFailure(_.through(stringArrayParser))
}

"stringStreamParser" should "return ParsingFailure" in {
testParsingFailure(_.through(stringStreamParser))
}

"byteArrayParser" should "return ParsingFailure" in {
testParsingFailure(_.through(text.utf8Encode).through(byteArrayParser))
}

"byteStreamParser" should "return ParsingFailure" in {
testParsingFailure(_.through(text.utf8Encode).through(byteStreamParser))
}

"byteArrayParserC" should "return ParsingFailure" in {
testParsingFailure(_.through(text.utf8Encode).chunks.through(byteArrayParserC))
}

"byteStreamParserC" should "return ParsingFailure" in {
testParsingFailure(_.through(text.utf8Encode).chunks.through(byteStreamParserC))
}

"decoder" should "return DecodingFailure" in
forAll { (fooStdStream: StdStream[Foo], fooVector: Vector[Foo]) =>
sealed trait Foo2
Expand All @@ -134,13 +110,4 @@ class Fs2Suite extends CirceSuite {
stream.through(through).compile.toVector.attempt.unsafeRunSync() === Right(foos.toVector))
}
}

private def testParsingFailure(through: Pipe[IO, String, Json]) = {
forAll { (stringStdStream: StdStream[String], stringVector: Vector[String]) =>
val result = Stream("}").append(stringStream(stringStdStream, stringVector))
.through(through)
.compile.toVector.attempt.unsafeRunSync()
assert(result.isLeft && result.left.get.isInstanceOf[ParsingFailure])
}
}
}