From 4aa13f75cebc0c70d18ddac6b4da4b69969cc561 Mon Sep 17 00:00:00 2001 From: takapi327 Date: Sun, 15 Oct 2023 23:43:17 +0900 Subject: [PATCH] Add compile test for table --- core/src/test/scala/ldbc/core/TableTest.scala | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/core/src/test/scala/ldbc/core/TableTest.scala b/core/src/test/scala/ldbc/core/TableTest.scala index 73627082f..62586203b 100644 --- a/core/src/test/scala/ldbc/core/TableTest.scala +++ b/core/src/test/scala/ldbc/core/TableTest.scala @@ -15,7 +15,7 @@ class TableTest extends AnyFlatSpec: case class User(id: Long, name: String, age: Int) val table: Table[User] = Table[User]("user")( - column("id", BIGINT(64)), + column("id", BIGINT(64), AUTO_INCREMENT), column("name", VARCHAR(255)), column("age", INT(255)) ) @@ -36,6 +36,36 @@ class TableTest extends AnyFlatSpec: """.stripMargin) } + it should "Setting AUTO_INCREMENT to a non-numeric type results in a compile error" in { + assertDoesNotCompile( + """ + import ldbc.core.* + + case class User(id: Long, name: String, age: Int) + + val table: Table[User] = Table[User]("user")( + column("id", BIGINT(64)), + column("name", VARCHAR(255), AUTO_INCREMENT), + column("age", INT(255)) + ) + """.stripMargin) + } + + it should "Setting Collate to anything other than a string type results in a compile error." in { + assertDoesNotCompile( + """ + import ldbc.core.* + + case class User(id: Long, name: String, age: Int) + + val table: Table[User] = Table[User]("user")( + column("id", BIGINT(64), Collate.AsciiBin), + column("name", VARCHAR(255)), + column("age", INT(255)) + ) + """.stripMargin) + } + it should "The type of the column accessed by selectDynamic matches the type of the specified column." in { case class User(id: Long, name: String, age: Int)