未验证 提交 55b5b113 编写于 作者: 梦境迷离's avatar 梦境迷离 提交者: GitHub

add unit test (#83)

* add unit test
上级 69bbf216
......@@ -13,5 +13,5 @@ comment:
behavior: default
ignore:
- "package.scala"
- "macros.scala"
\ No newline at end of file
- "src/main/scala/io/github/dreamylost/package.scala"
- "src/main/scala/io/github/dreamylost/macros/macros.scala"
\ No newline at end of file
......@@ -34,7 +34,7 @@ class ConstructorTest extends AnyFlatSpec with Matchers {
"constructor1" should "failed" in {
""" @constructor
| object A2 {
| case class A2() {
| private val a: Int = 1
| var b: Int = 1
| def helloWorld: String = "hello world"
......
......@@ -128,7 +128,7 @@ class EqualsAndHashCodeTest extends AnyFlatSpec with Matchers {
def hello: String = ???
}
"""
| @equalsAndHashCode
| @equalsAndHashCode(excludeFields = Nil)
| class Employee4(name: String, age: Int, var role: String) extends Person(name, age) {
| val i = 0
| def hello: String = ???
......@@ -146,9 +146,23 @@ class EqualsAndHashCodeTest extends AnyFlatSpec with Matchers {
|""".stripMargin shouldNot compile
"""
| @equalsAndHashCode(verbose = true, excludeFields = Seq("i"))
| class Employee4(name: String, age: Int, var role: String) extends Person(name, age) {
| @equalsAndHashCode(verbose = true, excludeFields = Seq("i", "j", "k", "t"))
| class Employee5(name: String, age: Int, var role: String) extends Person(name, age) {
| val i = 0
| var j = 0
| val k: Int = 1
| var t: Int = 2
| def hello: String = ???
| }
|""".stripMargin should compile
"""
| @equalsAndHashCode(verbose = true, excludeFields = Nil)
| class Employee6(name: String, age: Int, var role: String) extends Person(name, age) {
| val i = 0
| var j = 0
| val k: Int = 1
| var t: Int = 2
| def hello: String = ???
| }
|""".stripMargin should compile
......
......@@ -293,6 +293,8 @@ class ToStringTest extends AnyFlatSpec with Matchers {
| import io.github.dreamylost.logs.LogType
| @toString(includeFieldNames = false, callSuper = true, verbose = true)
| class TestClass6(val i: Int = 0, var j: Int)
|
| @toString(verbose = false, includeFieldNames = false) class TestClass6(val i: Int = 0, var j: Int)
|""".stripMargin shouldNot compile
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册