Skip to content

Commit

Permalink
Fix warnings in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Oct 7, 2024
1 parent 2c7c23f commit 5344de3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions core/shared/src/test/scala/fs2/StreamCombinatorsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ class StreamCombinatorsSuite extends Fs2Suite {
test("debounce") {
val delay = 200.milliseconds
TestControl.executeEmbed {
(Stream(1, 2, 3) ++ Stream.sleep[IO](delay * 2) ++ Stream() ++ Stream(4, 5) ++ Stream
.sleep[IO](delay / 2) ++ Stream(6))
(Stream(1, 2, 3) ++ Stream.sleep_[IO](delay * 2) ++ Stream() ++ Stream(4, 5) ++ Stream
.sleep_[IO](delay / 2) ++ Stream(6))
.debounce(delay)
.assertEmits(List(3, 6))
}
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/test/scala/fs2/StreamMergeSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class StreamMergeSuite extends Fs2Suite {
.merge(
Stream.bracket(register("R"))(_ => finalizer("R")) >>
Stream
.eval(halt.complete(())) // immediately interrupt the outer stream
.exec(halt.complete(()).void) // immediately interrupt the outer stream
)
}
.interruptWhen(halt.get.attempt)
Expand Down Expand Up @@ -156,7 +156,7 @@ class StreamMergeSuite extends Fs2Suite {

group("hangs") {
val full = if (isJVM) Stream.constant(42) else Stream.constant(42).evalTap(_ => IO.cede)
val hang = Stream.repeatEval(IO.never[Unit])
val hang = Stream.repeatEval(IO.never[Nothing])
val hang2: Stream[IO, Nothing] = full.drain
val hang3: Stream[IO, Nothing] =
Stream
Expand Down
14 changes: 7 additions & 7 deletions core/shared/src/test/scala/fs2/StreamSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class StreamSuite extends Fs2Suite {
test("8") {
Counter[IO].flatMap { counter =>
Pull
.pure(42)
.pure(())
.handleErrorWith(_ => Pull.eval(counter.increment))
.flatMap(_ => Pull.raiseError[IO](new Err))
.stream
Expand All @@ -294,7 +294,7 @@ class StreamSuite extends Fs2Suite {
test("9") {
Counter[IO].flatMap { counter =>
Pull
.eval(IO(42))
.eval(IO.unit)
.handleErrorWith(_ => Pull.eval(counter.increment))
.flatMap(_ => Pull.raiseError[IO](new Err))
.stream
Expand All @@ -308,9 +308,9 @@ class StreamSuite extends Fs2Suite {
Counter[IO].flatMap { counter =>
Pull
.eval(IO(42))
.flatMap { x =>
.flatMap { _ =>
Pull
.pure(x)
.pure(())
.handleErrorWith(_ => Pull.eval(counter.increment))
.flatMap(_ => Pull.raiseError[IO](new Err))
}
Expand Down Expand Up @@ -350,7 +350,7 @@ class StreamSuite extends Fs2Suite {
Stream
.range(0, 10)
.append(Stream.raiseError[IO](new Err))
.handleErrorWith(_ => Stream.eval(counter.increment))
.handleErrorWith(_ => Stream.exec(counter.increment))
.compile
.drain >> counter.get.assertEquals(1L)
}
Expand Down Expand Up @@ -970,8 +970,8 @@ class StreamSuite extends Fs2Suite {
Stream
.eval(Deferred[IO, Unit].product(Deferred[IO, Unit]))
.flatMap { case (startCondition, waitForStream) =>
val worker = Stream.eval(startCondition.get) ++ Stream.eval(
waitForStream.complete(())
val worker = Stream.eval(startCondition.get) ++ Stream.exec(
waitForStream.complete(()).void
)
val result = startCondition.complete(()) >> waitForStream.get

Expand Down
4 changes: 2 additions & 2 deletions io/jvm/src/test/scala/fs2/io/file/WatcherSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class WatcherSuite extends Fs2Suite with BaseFileSuite {
.flatMap { dir =>
val a = dir / "a"
val b = a / "b"
Stream.eval(Files[IO].createDirectory(a) >> Files[IO].createFile(b)) ++
Stream.exec(Files[IO].createDirectory(a) >> Files[IO].createFile(b)) ++
Files[IO]
.watch(dir, Nil, modifiers, 1.second)
.takeWhile {
Expand All @@ -159,7 +159,7 @@ class WatcherSuite extends Fs2Suite with BaseFileSuite {
case _ => true
}
.concurrently(
smallDelay ++ Stream.eval(Files[IO].createDirectory(a) >> Files[IO].createFile(b))
smallDelay ++ Stream.exec(Files[IO].createDirectory(a) >> Files[IO].createFile(b))
)
}
.compile
Expand Down
2 changes: 1 addition & 1 deletion io/shared/src/test/scala/fs2/io/process/ProcessSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class ProcessSuite extends Fs2IoSuite {
test("exit value cancelation") {
ProcessBuilder("cat")
.spawn[IO]
.use(_.exitValue)
.use(_.exitValue.void)
.timeoutTo(1.second, IO.unit) // assert that cancelation does not hang
}

Expand Down

0 comments on commit 5344de3

Please sign in to comment.