This repository was archived by the owner on Feb 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
modules/pulp/src/test/scala/io/scalaland/pulp Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ class FactorySpec extends Specification {
21
21
@ Factory class ComplexCase [T ](t : T , name : String , size : Int )
22
22
@ Factory class ComplexCase2 [T ](t : T )(name : String )(size : Int )
23
23
24
+ trait TestTC [T ]
25
+ @ Factory class TCCase1 [T : TestTC ](implicit i : Int )
26
+ @ Factory class TCCase2 [T : TestTC ]
27
+ @ Factory class TCCase3 [T : TestTC ](d : Double )(implicit i : Int )
28
+
24
29
" @Factory annotation" should {
25
30
26
31
" generate implicit Provider def for a monomorphic class without a companion" in {
@@ -55,5 +60,15 @@ class FactorySpec extends Specification {
55
60
56
61
Provider .get[ComplexCase2 [Double ]] must not(beNull)
57
62
}
63
+
64
+ " generate implicit Provider def for a class with type class constraint" in {
65
+ implicit val stringTCProvider : Provider [TestTC [String ]] = Provider .const(new TestTC [String ] {})
66
+ implicit val doubleProvider : Provider [Double ] = Provider .const(1.0 )
67
+ implicit val intProvider : Provider [Int ] = Provider .const(10 )
68
+
69
+ Provider .get[TCCase1 [String ]] must not(beNull)
70
+ Provider .get[TCCase2 [String ]] must not(beNull)
71
+ Provider .get[TCCase3 [String ]] must not(beNull)
72
+ }
58
73
}
59
74
}
You can’t perform that action at this time.
0 commit comments