Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some varargs issues in scala 2 and scala 3 #433

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix test
  • Loading branch information
jxnu-liguobin committed Mar 3, 2024
commit 84698eab912e5cce496daa46e8fcf6b6bb44308a
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ class Scala3LoggerSpec extends AnyWordSpec with Matchers with Varargs with Mocki
verify(underlying).info("""Hello {}""", arg5ref)
}

"work when passing a val as repeated arguments" in {
val f = fixture(_.isInfoEnabled, isEnabled = true)
import f._
val argss = Seq(arg5ref, arg5ref, arg5ref)
logger.info("""Hello {} {} {}""", argss:_*)
verify(underlying).info("""Hello {} {} {}""", Seq(arg5ref, arg5ref, arg5ref):_*)
}

"work when passing a inline def as repeated arguments" in {
val f = fixture(_.isInfoEnabled, isEnabled = true)
import f._
Expand Down
8 changes: 8 additions & 0 deletions src/test/scala/com/typesafe/scalalogging/LoggerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ class LoggerSpec extends AnyWordSpec with Matchers with Varargs with MockitoSuga
logger.info(s"Message with id=$message, submittedAt=$message will be dropped.")
verify(underlying).info("""Message with id={}, submittedAt={} will be dropped.""", forceVarargs(message, message): _*)
}

"work when passing a val as repeated arguments, issue 436" in {
val f = fixture(_.isInfoEnabled, isEnabled = true)
import f._
val argss = Seq(arg5ref, arg5ref, arg5ref)
logger.info("""Hello {} {} {}""", argss: _*)
verify(underlying).info("""Hello {} {} {}""", forceVarargs(arg5ref, arg5ref, arg5ref): _*)
}
}

"Calling info with a message and cause" should {
Expand Down
Loading