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

Add @toString in steps.annotation #14

Merged
merged 6 commits into from
Oct 15, 2024
Merged
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
Next Next commit
Add tests for steps.annotation.toString
hamzaremmal committed Oct 15, 2024
commit a9cc7833e2bd4009c2e2a323d7e10298508ce3c7
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