Skip to content

Commit 372da72

Browse files
committed
FunctionKLift dried test suite xcompile
1 parent 6de2a67 commit 372da72

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

tests/shared/src/test/scala-2/cats/tests/FunctionKLiftSuite.scala

-8
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ class FunctionKLiftSuite extends CatsSuite {
7272
}
7373
}
7474

75-
test("lift a function directly") {
76-
def headOption[A](list: List[A]): Option[A] = list.headOption
77-
val fHeadOption = FunctionK.liftFunction[List, Option](headOption)
78-
forAll { (a: List[Int]) =>
79-
assert(fHeadOption(a) === a.headOption)
80-
}
81-
}
82-
8375
{ // lifting concrete types should fail to compile
8476
def sample[A](option: Option[A]): List[A] = option.toList
8577
assert(compileErrors("FunctionK.lift(sample[String])").nonEmpty)

tests/shared/src/test/scala-3/cats/tests/FunctionKLiftSuite.scala

-8
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,4 @@ class FunctionKLiftSuite extends CatsSuite {
3434
assert(fHeadOption(a) === a.headOption)
3535
}
3636
}
37-
38-
test("lift a function directly using Scala 2 compatible syntax") {
39-
def headOption[A](list: List[A]): Option[A] = list.headOption
40-
val fHeadOption = FunctionK.liftFunction[List, Option](headOption)
41-
forAll { (a: List[Int]) =>
42-
assert(fHeadOption(a) === a.headOption)
43-
}
44-
}
4537
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2015 Typelevel
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
* this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to
7+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
* the Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*/
21+
22+
package cats.tests
23+
24+
import cats.arrow.FunctionK
25+
import cats.syntax.all._
26+
import org.scalacheck.Prop._
27+
28+
class FunctionKLiftFunctionSuite extends CatsSuite {
29+
test("lift a function directly") {
30+
def headOption[A](list: List[A]): Option[A] = list.headOption
31+
val fHeadOption = FunctionK.liftFunction[List, Option](headOption)
32+
forAll { (a: List[Int]) =>
33+
assert(fHeadOption(a) === a.headOption)
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)