Skip to content

Commit

Permalink
Adds compile-time tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelrenoux committed Mar 24, 2024
1 parent 82bb584 commit de5cf77
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,26 @@ trait DatabaseOpsCompileTest {

}


val typedServiceOperations: DatabaseTBase[Marker, Connection]
val typedModuleOperations: DatabaseTBase.Module[Marker, Connection, DatabaseService]

object DatabaseTChecks {

val a: ZIO[Environment, Either[DbException, String], Int] =
typedServiceOperations.transaction(z[Connection with Environment, String])

val b: ZIO[Any, Either[DbException, String], Int] =
typedServiceOperations.transaction(z[Connection, String])

val c: ZIO[DatabaseT[Marker] with Environment, Either[DbException, String], Int] =
typedModuleOperations.transaction(z[Connection with Environment, String])

val d: ZIO[DatabaseT[Marker], Either[DbException, String], Int] =
typedModuleOperations.transaction(z[Connection, String])

}

}

object DatabaseOpsCompileTest {
Expand All @@ -239,5 +259,9 @@ object DatabaseOpsCompileTest {

type Database = DatabaseService

type DatabaseT[M] = DatabaseTBase[M, Connection]

trait Environment

trait Marker
}

0 comments on commit de5cf77

Please sign in to comment.