Skip to content

Commit

Permalink
Add compile test for table
Browse files Browse the repository at this point in the history
  • Loading branch information
takapi327 committed Oct 15, 2023
1 parent 5066208 commit 4aa13f7
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion core/src/test/scala/ldbc/core/TableTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
Expand All @@ -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)

Expand Down

0 comments on commit 4aa13f7

Please sign in to comment.