Skip to content

Commit ba7da9b

Browse files
committed
Update: test-logger-f-core - Update the code for testing compile-time error
1 parent beb722f commit ba7da9b

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

modules/test-logger-f-core/shared/src/test/scala-2/core_testing/LogWithoutCustomInstanceSpec.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package core_testing
22

3-
import effectie.core._
43
import extras.testing.CompileTimeError
54
import hedgehog._
65
import hedgehog.runner._
7-
import loggerf.core._
8-
import loggerf.core.syntax.all._
9-
import loggerf.logger.{CanLog, Slf4JLogger}
106

117
/** @author Kevin Lee
128
* @since 2025-08-05
@@ -17,10 +13,6 @@ object LogWithoutCustomInstanceSpec extends Properties {
1713
example("test compile time error", testCompileTimeError)
1814
)
1915

20-
implicit val canLog: CanLog = Slf4JLogger.slf4JCanLog("test-can-log")
21-
22-
def foo[F[*]: Fx: Log](n: Int): F[Int] = Log[F].log(Fx[F].effectOf(n * 2))(n => info(n.toString))
23-
2416
@SuppressWarnings(Array("org.wartremover.warts.Equals"))
2517
def testCompileTimeError: Result = {
2618
val expected =
@@ -70,9 +62,19 @@ object LogWithoutCustomInstanceSpec extends Properties {
7062

7163
val actual = CompileTimeError.from(
7264
"""
65+
import effectie.core._
66+
import loggerf.core._
67+
import loggerf.core.syntax.all._
68+
import loggerf.logger.{CanLog, Slf4JLogger}
69+
7370
import effectie.instances.tries.fx._
7471
import scala.util.Try
7572
73+
implicit val canLog: CanLog = Slf4JLogger.slf4JCanLog("test-can-log")
74+
75+
def foo[F[*]: Fx: Log](n: Int): F[Int] = Log[F].log(Fx[F].effectOf(n * 2))(n => info(n.toString))
76+
77+
7678
foo[Try](1)
7779
"""
7880
)

modules/test-logger-f-core/shared/src/test/scala-3/core_testing/LogWithoutCustomInstanceSpec.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package core_testing
22

3-
import effectie.core._
43
import hedgehog._
54
import hedgehog.runner._
6-
import loggerf.core._
7-
import loggerf.core.syntax.all._
8-
import loggerf.logger.{CanLog, Slf4JLogger}
95

106
/** @author Kevin Lee
117
* @since 2025-08-05
@@ -16,10 +12,6 @@ object LogWithoutCustomInstanceSpec extends Properties {
1612
example("test compile time error", testCompileTimeError)
1713
)
1814

19-
implicit val canLog: CanLog = Slf4JLogger.slf4JCanLog("test-can-log")
20-
21-
def foo[F[*]: Fx: Log](n: Int): F[Int] = Log[F].log(Fx[F].effectOf(n * 2))(n => info(n.toString))
22-
2315
@SuppressWarnings(Array("org.wartremover.warts.Equals"))
2416
def testCompileTimeError: Result = {
2517
val expectedMessage =
@@ -66,9 +58,19 @@ object LogWithoutCustomInstanceSpec extends Properties {
6658

6759
val actual = typeCheckErrors(
6860
"""
69-
import effectie.instances.tries.fx._
61+
import effectie.core.*
62+
import loggerf.core.*
63+
import loggerf.core.syntax.all.*
64+
import loggerf.logger.{CanLog, Slf4JLogger}
65+
66+
import effectie.instances.tries.fx.given
7067
import scala.util.Try
7168
69+
given canLog: CanLog = Slf4JLogger.slf4JCanLog("test-can-log")
70+
71+
def foo[F[*]: Fx: Log](n: Int): F[Int] = Log[F].log(Fx[F].effectOf(n * 2))(n => info(n.toString))
72+
73+
7274
foo[Try](1)
7375
"""
7476
)

0 commit comments

Comments
 (0)