Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.0.4"
version = "3.0.8"
maxColumn = 140
align.preset = some
align.tokens.add = [
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ val examples =
commonSettings,
libraryDependencies ++= List(
"org.typelevel" %% "cats-effect" % "3.2.9",
//this won't work for now
// this won't work for now
"org.tpolecat" %% "doobie-hikari" % "1.0.0-M4",
"org.postgresql" % "postgresql" % "42.2.20"
)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/flawless/api/dsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ trait AllDsl {
NonEmptyList.one(Test(name, TestRun.Lazy(Eval.later(assertions))))

object ensure {
//todo inconsistent with ensureM.apply
// todo inconsistent with ensureM.apply
def apply[F[_], A](value: A, predicate: PredicateT[F, A]): F[Assertion] = predicate(value)
def fun[F[_], A](value: A)(predicate: A => F[Assertion]): F[Assertion] = ensure(value, PredicateT(predicate))
}
Expand All @@ -66,7 +66,7 @@ trait AllDsl {
apply(value)(PredicateT[cats.Id, A](predicate))
}

//todo naming
// todo naming
def ensureEqualEq[A: Eq: Show](actual: A, expected: A): Assertion =
ensure(actual, flawless.predicates.equalToEq(expected))

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/flawless/api/predicates.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait AllPredicates {
Assertion
.failed(
show"$actual (actual) was not equal to $expected (expected). Diff: ${Console.RESET}$diff"
) //this reset is a hacky hack, but works!
) // this reset is a hacky hack, but works!
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/flawless/data/data.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,10 @@ object Suite {
implicit def suiteSemigroup[F[_]: Apply]: Semigroup[Suite[F]] = _ zip _

def renameEach[F[_]: FlatMap](modName: String => F[String]): Suite[F] => Suite[F] = {
//todo what about stack safety in the case of tests in Id?
// todo what about stack safety in the case of tests in Id?
def go(self: Suite[F]): F[Suite[F]] = self match {
case o: algebra.One[f] =>
//typing newName manually is needed due to GADT limitation
// typing newName manually is needed due to GADT limitation
Functor[f].map(modName(o.name))(algebra.One[f](_: String, o.tests))

case s: algebra.Sequence[f] => s.traversal.traverse(s.suites)(go)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/flawless/eval/eval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package object eval {

import cats.Applicative

//todo: show names of suites
// todo: show names of suites
def toTerminalOutput(output: Output): (String, ExitCode) = {
import scala.io.AnsiColor

Expand Down Expand Up @@ -96,7 +96,7 @@ package object eval {

def loadArgs[F[_]: Applicative](args: List[String]): F[Settings] = {
val _ = args
//todo actually read the args
// todo actually read the args
Settings(visual = true).pure[F]
// Settings(visual = false).pure[F]
// Settings(visual = args.contains("visual")).pure[F]
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/flawless/eval/interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait Interpreter[F[_]] {
}

object Interpreter {
//A type alias for an action that interprets a single instance of Algebra (e.g. suite or test)
// A type alias for an action that interprets a single instance of Algebra (e.g. suite or test)
type InterpretOne[Algebra[_[_]], F[_]] = Algebra[F] => F[Algebra[NoEffect]]

def defaultInterpreter[F[_]: MonadThrow]: Interpreter[F] =
Expand All @@ -45,7 +45,7 @@ object Interpreter {
def finish(results: Assertion): Test[NoEffect] = Test(test.name, TestRun.Pure(results))

val exec: F[Test[NoEffect]] = test.result match {
//this is a GADT skolem - you think I'd know what that means by now...
// this is a GADT skolem - you think I'd know what that means by now...
case eval: TestRun.Eval[f] => (eval.effect.handleError(Assertion.thrown(_)): F[Assertion]).map(finish)
case TestRun.Pure(result) => finish(result).pure[F]
case TestRun.Lazy(e) =>
Expand All @@ -66,7 +66,7 @@ object Interpreter {

reporter.publish(Reporter.Event.SuiteStarted(suite.name, id)) *>
suite.tests.nonEmptyTraverse(interpretTest(reporter).apply(_)).map(finish).flatTap { suiteResult =>
//todo duplicated logic!!!!
// todo duplicated logic!!!!
val isSuccessful =
suiteResult
.tests
Expand Down Expand Up @@ -142,7 +142,7 @@ object Reporter {

final case class SuiteHistory(cells: Chain[SuiteHistory.Cell]) {

//reference implementation, will be overridden for more performance (and possibly no fs2 dependency in eval)
// reference implementation, will be overridden for more performance (and possibly no fs2 dependency in eval)
def stringify: String = {
val failedSuites = cells.count(_.status === SuiteHistory.Status.Failed)

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/flawless/eval/stats.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object RunStats {
)
}

//Getters/folds for suite/test/assertion results
// Getters/folds for suite/test/assertion results
private object optics {

private val suiteTests: Getter[Suite[Id], NonEmptyList[Test[Id]]] =
Expand Down
4 changes: 2 additions & 2 deletions examples/src/main/scala/flawless/examples/ExampleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ object ExampleTests extends IOApp with TestApp {
Suite
.resource[IO] {
xa.map { transactor =>
new DoobieQueryTests(transactor).runSuite.parCombineN(5) //5 suites per allocation
new DoobieQueryTests(transactor).runSuite.parCombineN(5) // 5 suites per allocation
}
}
.parCombineN(2) //2 allocations
.parCombineN(2) // 2 allocations
}

override def run(args: List[String]): IO[ExitCode] =
Expand Down
2 changes: 1 addition & 1 deletion tests/src/main/scala/flawlessly/GetStatsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ object GetStatsTest extends SuiteClass[NoEffect] {
)
}

//todo property based tests - the total amount of each stat should be the sum of failed+succeeded
// todo property based tests - the total amount of each stat should be the sum of failed+succeeded
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ object InterpreterReportingTest {
SuiteFinished("suite 1", id, succeeded = true)
).map(LogEvent.Report(_))

//todo: why are these instances not visible?
// todo: why are these instances not visible?
def simpleResource(suite: Suite[WC]): Suite[WC] = Suite.resource(suite.pure[Resource[WC, *]])(wcMonadCancel)

//todo: these would be good property tests
// todo: these would be good property tests
suite("InterpreterReportingTest") {
tests(
test("single suite") {
Expand Down
2 changes: 1 addition & 1 deletion tests/src/main/scala/flawlessly/MonadicTestSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object MonadicTestSuite {

tests(
test("monadic tests fail when no assertions are given") {
//todo: tests shouldn't return lists anymore... I know, free monoid :(
// todo: tests shouldn't return lists anymore... I know, free monoid :(
val NonEmptyList(theTest, _) = testMonadic[F]("demo")(_ => Applicative[F].unit)

ensure(theTest, failedDueToAssertions)
Expand Down
4 changes: 2 additions & 2 deletions tests/src/main/scala/flawlessly/TestReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class TestReporter[F[_]: MonadCancelThrow] {
type WC[A] = ReaderWriterStateT[F, Unit, Chain[LogEvent], Int, A]

implicit val wcMonadCancel: MonadCancel[WC, Throwable] = MonadCancel.monadCancelForReaderWriterStateT
//The instance shall not be used for parallelism! It's pretty much just a marker
// The instance shall not be used for parallelism! It's pretty much just a marker
implicit val wcParallel: Parallel[WC] = Parallel.identity

val reporter: Reporter.Aux[WC, Int] = {
Expand Down Expand Up @@ -65,7 +65,7 @@ final class TestReporter[F[_]: MonadCancelThrow] {
def reported[G[_]: Foldable](expectedWritten: G[LogEvent]): PredicateT[F, Suite[WC]] =
reportedWith[G](equalTo(expectedWritten.toList))

//todo naming
// todo naming
def reportedWith[G[_]: Foldable](writtenPredicate: Predicate[List[LogEvent]]): PredicateT[F, Suite[WC]] =
select[Suite[WC]](interpreter.interpret(reporter)(_).written.runA((), 0).map(_.toList))(
writtenPredicate.liftM[F]
Expand Down