From 372da725101a3e5a0f7d1ff7af3d33f1f35bf8a1 Mon Sep 17 00:00:00 2001 From: Grigory Pomadchin Date: Mon, 13 May 2024 12:35:31 -0400 Subject: [PATCH 1/2] FunctionKLift dried test suite xcompile --- .../cats/tests/FunctionKLiftSuite.scala | 8 ----- .../cats/tests/FunctionKLiftSuite.scala | 8 ----- .../tests/FunctionKLiftFuctionSuite.scala | 36 +++++++++++++++++++ 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala diff --git a/tests/shared/src/test/scala-2/cats/tests/FunctionKLiftSuite.scala b/tests/shared/src/test/scala-2/cats/tests/FunctionKLiftSuite.scala index 7dd041d2bc..04257a3474 100644 --- a/tests/shared/src/test/scala-2/cats/tests/FunctionKLiftSuite.scala +++ b/tests/shared/src/test/scala-2/cats/tests/FunctionKLiftSuite.scala @@ -72,14 +72,6 @@ class FunctionKLiftSuite extends CatsSuite { } } - test("lift a function directly") { - def headOption[A](list: List[A]): Option[A] = list.headOption - val fHeadOption = FunctionK.liftFunction[List, Option](headOption) - forAll { (a: List[Int]) => - assert(fHeadOption(a) === a.headOption) - } - } - { // lifting concrete types should fail to compile def sample[A](option: Option[A]): List[A] = option.toList assert(compileErrors("FunctionK.lift(sample[String])").nonEmpty) diff --git a/tests/shared/src/test/scala-3/cats/tests/FunctionKLiftSuite.scala b/tests/shared/src/test/scala-3/cats/tests/FunctionKLiftSuite.scala index 9345706234..da70f8fc87 100644 --- a/tests/shared/src/test/scala-3/cats/tests/FunctionKLiftSuite.scala +++ b/tests/shared/src/test/scala-3/cats/tests/FunctionKLiftSuite.scala @@ -34,12 +34,4 @@ class FunctionKLiftSuite extends CatsSuite { assert(fHeadOption(a) === a.headOption) } } - - test("lift a function directly using Scala 2 compatible syntax") { - def headOption[A](list: List[A]): Option[A] = list.headOption - val fHeadOption = FunctionK.liftFunction[List, Option](headOption) - forAll { (a: List[Int]) => - assert(fHeadOption(a) === a.headOption) - } - } } diff --git a/tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala b/tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala new file mode 100644 index 0000000000..af4b0e1706 --- /dev/null +++ b/tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015 Typelevel + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package cats.tests + +import cats.arrow.FunctionK +import cats.syntax.all._ +import org.scalacheck.Prop._ + +class FunctionKLiftFunctionSuite extends CatsSuite { + test("lift a function directly") { + def headOption[A](list: List[A]): Option[A] = list.headOption + val fHeadOption = FunctionK.liftFunction[List, Option](headOption) + forAll { (a: List[Int]) => + assert(fHeadOption(a) === a.headOption) + } + } +} From b61ba09611b099b3d4957c574404f22955914ed2 Mon Sep 17 00:00:00 2001 From: Grigory Pomadchin Date: Mon, 13 May 2024 21:31:03 -0400 Subject: [PATCH 2/2] FunctionKLiftCrossBuildSuite => FunctionKLiftCrossBuildSuite --- ...iftFuctionSuite.scala => FunctionKLiftCrossBuildSuite.scala} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/shared/src/test/scala/cats/tests/{FunctionKLiftFuctionSuite.scala => FunctionKLiftCrossBuildSuite.scala} (96%) diff --git a/tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala b/tests/shared/src/test/scala/cats/tests/FunctionKLiftCrossBuildSuite.scala similarity index 96% rename from tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala rename to tests/shared/src/test/scala/cats/tests/FunctionKLiftCrossBuildSuite.scala index af4b0e1706..5edb678a96 100644 --- a/tests/shared/src/test/scala/cats/tests/FunctionKLiftFuctionSuite.scala +++ b/tests/shared/src/test/scala/cats/tests/FunctionKLiftCrossBuildSuite.scala @@ -25,7 +25,7 @@ import cats.arrow.FunctionK import cats.syntax.all._ import org.scalacheck.Prop._ -class FunctionKLiftFunctionSuite extends CatsSuite { +class FunctionKLiftCrossBuildSuite extends CatsSuite { test("lift a function directly") { def headOption[A](list: List[A]): Option[A] = list.headOption val fHeadOption = FunctionK.liftFunction[List, Option](headOption)