Overhauled packaging and began to pull out common test code.
This commit is contained in:
parent
ddb977b80c
commit
f4f2462d15
28 changed files with 73 additions and 62 deletions
36
build.sbt
36
build.sbt
|
@ -57,18 +57,35 @@ lazy val testSettings = Seq(
|
||||||
lazy val `gs-test` = project
|
lazy val `gs-test` = project
|
||||||
.in(file("."))
|
.in(file("."))
|
||||||
.aggregate(
|
.aggregate(
|
||||||
`api-definition`,
|
`test-support`,
|
||||||
`api-execution`
|
api,
|
||||||
|
runtime
|
||||||
)
|
)
|
||||||
.settings(noPublishSettings)
|
.settings(noPublishSettings)
|
||||||
.settings(name := s"${gsProjectName.value}-v${semVerMajor.value}")
|
.settings(name := s"${gsProjectName.value}-v${semVerMajor.value}")
|
||||||
|
|
||||||
lazy val `api-definition` = project
|
lazy val `test-support` = project
|
||||||
.in(file("modules/api-definition"))
|
.in(file("modules/test-support"))
|
||||||
|
.settings(sharedSettings)
|
||||||
|
.settings(testSettings)
|
||||||
|
.settings(noPublishSettings)
|
||||||
|
.settings(
|
||||||
|
name := s"${gsProjectName.value}-test-support"
|
||||||
|
)
|
||||||
|
.settings(
|
||||||
|
libraryDependencies ++= Seq(
|
||||||
|
Deps.Cats.Core,
|
||||||
|
Deps.Cats.Effect
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
lazy val api = project
|
||||||
|
.in(file("modules/api"))
|
||||||
|
.dependsOn(`test-support` % "test->test")
|
||||||
.settings(sharedSettings)
|
.settings(sharedSettings)
|
||||||
.settings(testSettings)
|
.settings(testSettings)
|
||||||
.settings(
|
.settings(
|
||||||
name := s"${gsProjectName.value}-api-definition-v${semVerMajor.value}"
|
name := s"${gsProjectName.value}-api-v${semVerMajor.value}"
|
||||||
)
|
)
|
||||||
.settings(
|
.settings(
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
|
@ -78,13 +95,14 @@ lazy val `api-definition` = project
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val `api-execution` = project
|
lazy val runtime = project
|
||||||
.in(file("modules/api-execution"))
|
.in(file("modules/runtime"))
|
||||||
.dependsOn(`api-definition`)
|
.dependsOn(`test-support` % "test->test")
|
||||||
|
.dependsOn(api)
|
||||||
.settings(sharedSettings)
|
.settings(sharedSettings)
|
||||||
.settings(testSettings)
|
.settings(testSettings)
|
||||||
.settings(
|
.settings(
|
||||||
name := s"${gsProjectName.value}-api-execution-v${semVerMajor.value}"
|
name := s"${gsProjectName.value}-runtime-v${semVerMajor.value}"
|
||||||
)
|
)
|
||||||
.settings(
|
.settings(
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package gs.test.v0.execution.engine
|
|
||||||
|
|
||||||
import gs.test.v0.execution.SuiteExecution
|
|
||||||
|
|
||||||
final class EngineResult(
|
|
||||||
val suiteExecution: SuiteExecution
|
|
||||||
)
|
|
|
@ -1,6 +1,5 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
import scala.reflect.*
|
import scala.reflect.*
|
||||||
|
|
||||||
sealed abstract class Assertion(val name: String)
|
sealed abstract class Assertion(val name: String)
|
|
@ -1,7 +1,6 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.effect.Sync
|
import cats.effect.Sync
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
import scala.reflect.ClassTag
|
import scala.reflect.ClassTag
|
||||||
|
|
||||||
/** Opaque type used to check candidate values against expected values.
|
/** Opaque type used to check candidate values against expected values.
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
/** Enumeration for _Markers_, special tokens which "mark" a test to change
|
/** Enumeration for _Markers_, special tokens which "mark" a test to change
|
||||||
* execution functionality.
|
* execution functionality.
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition.pos
|
package gs.test.v0.api
|
||||||
|
|
||||||
import scala.quoted.*
|
import scala.quoted.*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
|
|
||||||
/** Each instance of this class indicates the _definition_ of some test.
|
/** Each instance of this class indicates the _definition_ of some test.
|
||||||
*
|
*
|
|
@ -1,6 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
|
|
||||||
/** Base trait for all failures recognized by gs-test.
|
/** Base trait for all failures recognized by gs-test.
|
||||||
*/
|
*/
|
|
@ -1,9 +1,8 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.data.EitherT
|
import cats.data.EitherT
|
||||||
import cats.effect.Async
|
import cats.effect.Async
|
||||||
import cats.syntax.all.*
|
import cats.syntax.all.*
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
import scala.jdk.CollectionConverters.*
|
import scala.jdk.CollectionConverters.*
|
||||||
|
@ -14,7 +13,7 @@ import scala.jdk.CollectionConverters.*
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
*
|
*
|
||||||
* final class MyTestGroup extends TestGroup.IO:
|
* final class MyTestGroup extends TestGroup.IO:
|
||||||
* override def name: String = "My Test Group"
|
* override def name: String = "My Test Group"
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
import cats.effect.Async
|
import cats.effect.Async
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
/** The Test Suite is the primary unit of organization within `gs-test` -- each
|
/** The Test Suite is the primary unit of organization within `gs-test` -- each
|
||||||
* execution _typically_ runs a single test suite. For example, the unit tests
|
* execution _typically_ runs a single test suite. For example, the unit tests
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.~>
|
import cats.~>
|
||||||
import cats.Applicative
|
import cats.Applicative
|
|
@ -1,10 +1,9 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.Applicative
|
import cats.Applicative
|
||||||
import cats.data.EitherT
|
import cats.data.EitherT
|
||||||
import cats.effect.Sync
|
import cats.effect.Sync
|
||||||
import cats.syntax.all.*
|
import cats.syntax.all.*
|
||||||
import gs.test.v0.definition.pos.SourcePosition
|
|
||||||
|
|
||||||
/** Type alias for test results. Test results are either a [[TestFailure]] or a
|
/** Type alias for test results. Test results are either a [[TestFailure]] or a
|
||||||
* unit value (indicating success).
|
* unit value (indicating success).
|
||||||
|
@ -15,7 +14,7 @@ type TestResult = Either[TestFailure, Unit]
|
||||||
* instances.
|
* instances.
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
* val tag1: TestDefinition.Tag = tag"example"
|
* val tag1: TestDefinition.Tag = tag"example"
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
|
@ -25,7 +24,7 @@ extension (sc: StringContext) def tag(args: Any*): Tag = Tag(sc.s(args*))
|
||||||
* [[PermanentId]] instances.
|
* [[PermanentId]] instances.
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
* val permanentId: PermanentId = pid"example"
|
* val permanentId: PermanentId = pid"example"
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +81,7 @@ def failT[F[_]: Applicative](
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
*
|
*
|
||||||
* final class Example extends TestGroup.IO:
|
* final class Example extends TestGroup.IO:
|
||||||
* override def name: String = "example"
|
* override def name: String = "example"
|
||||||
|
@ -100,7 +99,7 @@ def pass(): Either[TestFailure, Unit] = Right(())
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
*
|
*
|
||||||
* final class Example extends TestGroup.IO:
|
* final class Example extends TestGroup.IO:
|
||||||
* override def name: String = "example"
|
* override def name: String = "example"
|
||||||
|
@ -119,7 +118,7 @@ def passF[F[_]: Applicative](): F[Either[TestFailure, Unit]] =
|
||||||
* ## Example
|
* ## Example
|
||||||
*
|
*
|
||||||
* {{{
|
* {{{
|
||||||
* import gs.test.v0.definition.*
|
* import gs.test.v0.api.*
|
||||||
*
|
*
|
||||||
* final class Example extends TestGroup.IO:
|
* final class Example extends TestGroup.IO:
|
||||||
* override def name: String = "example"
|
* override def name: String = "example"
|
|
@ -1,9 +1,9 @@
|
||||||
package gs.test.v0.definition
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.data.Kleisli
|
import cats.data.Kleisli
|
||||||
import cats.effect.Async
|
import cats.effect.Async
|
||||||
import cats.effect.IO
|
import cats.effect.IO
|
||||||
import gs.test.v0.definition.{Tag => GsTag}
|
import gs.test.v0.api.{Tag => GsTag}
|
||||||
import munit.*
|
import munit.*
|
||||||
import natchez.Span
|
import natchez.Span
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package gs.test.v0.definition.pos
|
package gs.test.v0.api
|
||||||
|
|
||||||
import cats.effect.IO
|
import cats.effect.IO
|
||||||
import cats.effect.kernel.Resource
|
import cats.effect.kernel.Resource
|
||||||
import gs.test.v0.IOSuite
|
import gs.test.v0.api.*
|
||||||
import gs.test.v0.definition.*
|
|
||||||
import munit.*
|
import munit.*
|
||||||
import natchez.EntryPoint
|
import natchez.EntryPoint
|
||||||
import natchez.Kernel
|
import natchez.Kernel
|
||||||
import natchez.Span
|
import natchez.Span
|
||||||
import natchez.Span.Options
|
import natchez.Span.Options
|
||||||
|
import support.IOSuite
|
||||||
|
|
||||||
/** These tests are sensitive to changes, even in formatting! They are looking
|
/** These tests are sensitive to changes, even in formatting! They are looking
|
||||||
* for specific line numbers in this source code, so any sort of newline that
|
* for specific line numbers in this source code, so any sort of newline that
|
||||||
|
@ -87,12 +87,12 @@ object SourcePositionTests:
|
||||||
override def name: String = "G2"
|
override def name: String = "G2"
|
||||||
|
|
||||||
test(pid"t2", "pos").pure {
|
test(pid"t2", "pos").pure {
|
||||||
gs.test.v0.definition.fail("Expected Failure")
|
gs.test.v0.api.fail("Expected Failure")
|
||||||
}
|
}
|
||||||
|
|
||||||
end G2
|
end G2
|
||||||
|
|
||||||
val SourceFileName: String =
|
val SourceFileName: String =
|
||||||
"modules/api-definition/src/test/scala/gs/test/v0/definition/pos/SourcePositionTests.scala"
|
"modules/api/src/test/scala/gs/test/v0/api/SourcePositionTests.scala"
|
||||||
|
|
||||||
end SourcePositionTests
|
end SourcePositionTests
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution
|
package gs.test.v0.runtime
|
||||||
|
|
||||||
import gs.uuid.v0.UUID
|
import gs.uuid.v0.UUID
|
||||||
import java.time.Instant
|
import java.time.Instant
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution
|
package gs.test.v0.runtime
|
||||||
|
|
||||||
import cats.Show
|
import cats.Show
|
||||||
import gs.test.v0.definition.Marker
|
import gs.test.v0.definition.Marker
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
sealed abstract class ConcurrencySetting(val name: String):
|
sealed abstract class ConcurrencySetting(val name: String):
|
||||||
def toInt(): Int
|
def toInt(): Int
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
/** Used to control the behavior of some [[TestEngine]]
|
/** Used to control the behavior of some [[TestEngine]]
|
||||||
*
|
*
|
|
@ -0,0 +1,7 @@
|
||||||
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
|
import gs.test.v0.runtime.SuiteExecution
|
||||||
|
|
||||||
|
final class EngineResult(
|
||||||
|
val suiteExecution: SuiteExecution
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
import cats.effect.Async
|
import cats.effect.Async
|
||||||
import cats.effect.Ref
|
import cats.effect.Ref
|
|
@ -1,7 +1,7 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
import gs.test.v0.definition.TestGroupDefinition
|
import gs.test.v0.definition.TestGroupDefinition
|
||||||
import gs.test.v0.execution.TestExecution
|
import gs.test.v0.runtime.TestExecution
|
||||||
import scala.concurrent.duration.FiniteDuration
|
import scala.concurrent.duration.FiniteDuration
|
||||||
|
|
||||||
final class GroupResult(
|
final class GroupResult(
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
opaque type MaximumConcurrency = Int
|
opaque type MaximumConcurrency = Int
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0.execution.engine
|
package gs.test.v0.runtime.engine
|
||||||
|
|
||||||
import cats.effect.Async
|
import cats.effect.Async
|
||||||
import cats.syntax.all.*
|
import cats.syntax.all.*
|
||||||
|
@ -6,8 +6,8 @@ import gs.test.v0.definition.TestDefinition
|
||||||
import gs.test.v0.definition.TestFailure
|
import gs.test.v0.definition.TestFailure
|
||||||
import gs.test.v0.definition.TestGroupDefinition
|
import gs.test.v0.definition.TestGroupDefinition
|
||||||
import gs.test.v0.definition.TestSuite
|
import gs.test.v0.definition.TestSuite
|
||||||
import gs.test.v0.execution.SuiteExecution
|
import gs.test.v0.runtime.SuiteExecution
|
||||||
import gs.test.v0.execution.TestExecution
|
import gs.test.v0.runtime.TestExecution
|
||||||
import gs.timing.v0.Timing
|
import gs.timing.v0.Timing
|
||||||
import gs.uuid.v0.UUID
|
import gs.uuid.v0.UUID
|
||||||
import java.time.Clock
|
import java.time.Clock
|
|
@ -1,4 +1,4 @@
|
||||||
package gs.test.v0
|
package support
|
||||||
|
|
||||||
import cats.effect.IO
|
import cats.effect.IO
|
||||||
import cats.effect.unsafe.IORuntime
|
import cats.effect.unsafe.IORuntime
|
Loading…
Add table
Reference in a new issue