-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add todo for resource factory method
- Loading branch information
Showing
3 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
macrosCatsEffectTests/src/test/resources/test-cases/resourceFactoryWithParameters.success
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import com.softwaremill.macwire.catseffectsupport._ | ||
|
||
#include commonSimpleClasses | ||
import cats.effect._ | ||
|
||
val factoryParams = scala.collection.mutable.ListBuffer[B]() | ||
|
||
object Test { | ||
def theA(b: B): A = { factoryParams.append(b); A() } | ||
val theB: Resource[IO, B] = Resource.pure(B()) | ||
val theC: Resource[IO, C] = wireApp[C](theA _, theB) | ||
} | ||
|
||
val theC: C = { | ||
import cats.effect.unsafe.implicits.global | ||
Test.theC.allocated.unsafeRunSync()._1 | ||
} | ||
|
||
require(theC.a != null) | ||
require(theC.b != null) | ||
|
||
require(factoryParams.length == 1) | ||
require(factoryParams.head eq theC.b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters