Skip to content

Commit

Permalink
Merge branch 'main' into update/sbt-scalajs-1.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist authored Mar 1, 2024
2 parents 686dc4d + 912db55 commit eaec6e1
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sealed trait PropF[F[_]] {
next.checkOne(Prop.slideSeed(params))
}
case PropF.Parameterized(next) =>
next(params).checkOne(Prop.slideSeed(params))
next(Prop.slideSeed(params)).checkOne(Prop.slideSeed(params))
}
}

Expand Down
54 changes: 54 additions & 0 deletions munit/shared/src/test/scala/munit/ScalaCheckEffectSuiteSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2021 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package munit

import cats.effect.IO
import cats.effect.unsafe.implicits.global
import org.scalacheck.effect.PropF
import org.scalacheck.Shrink

// Who tests the tests?
class ScalaCheckEffectSuiteSuite extends ScalaCheckEffectSuite {

implicit def noShrink[T]: Shrink[T] = Shrink.shrinkAny[T]

override def munitValueTransforms: List[ValueTransform] =
super.munitValueTransforms ++ List(munitIOTransform)

// From https://github.com/scalameta/munit/pull/134
private val munitIOTransform: ValueTransform =
new ValueTransform("IO", { case e: IO[_] => e.unsafeToFuture() })

test("Correctly slides seed for multi-arg PropF") {
var last: Option[Int] = None
var duplicates = 0

PropF.forAllF { (x: Int, y: Int) =>
if (Some(x) == last) {
duplicates = duplicates + 1
}
last = Some(y)

// This is a bit of a heuristic as the generator may genuinely produce identical consecutive values
// The bug was that it wasn't sliding so the first generated value was _always_ equal to the second
// generated value from the previous iteration
IO { assert(clue(duplicates) < 10) }
}

}

}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.3
sbt.version=1.9.9
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.15.0")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.21")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

0 comments on commit eaec6e1

Please sign in to comment.