Skip to content

Commit

Permalink
Add tests for steps.annotation.toString
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzaremmal committed Oct 15, 2024
1 parent 8bbb7e5 commit a9cc783
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/scala/steps/annotation/toString.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package steps.annotation

import scala.annotation.experimental
import scala.language.experimental.clauseInterleaving

@toString
@experimental
class Foo1(val a: Int, val b: String)

@toString
@experimental
class Foo2(a: Int, b: String)

@toString
@experimental
class Foo3(var a: Int, var b: String)

@toString
@experimental
class Foo4(a: Int, b: String)(c: Int)

@experimental
class AssertToStringBehaviour extends munit.FunSuite:

test("@toString works with all kinds of classes"):
assertEquals(Foo1(1, "hello").toString(), "Foo1(1, hello)")
assertEquals(Foo2(1, "hello").toString(), "Foo2(1, hello)")
assertEquals(Foo3(1, "hello").toString(), "Foo3(1, hello)")
assertEquals(Foo4(1, "hello")(2).toString(), "Foo4(1, hello, 2)")

end AssertToStringBehaviour

0 comments on commit a9cc783

Please sign in to comment.