Skip to content

Commit

Permalink
style: format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Jan 21, 2024
1 parent bdd6b25 commit c5c7d9a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class ActionSpec(using ee: ExecutionEnv) extends Specification {
// all effects are executed, including finalizers
result.sorted === List("a1-1", "a2-1", "a1-2", "a2-2", "final1", "final2").sorted


def finalizers2 =
val messages = ListBuffer[String]();
def add(m: String) = messages.addOne(m)
Expand Down
16 changes: 12 additions & 4 deletions core/jvm/src/test/scala/org/specs2/control/OperationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ class OperationSpec extends Specification {
val operation = FileSystem(NoLogger).readFile(FilePath("missing")).orElse(Operation.ok("ok"))
operation.runOption === Some("ok")


def finalizers1 =
val messages = ListBuffer[String]();
def add(m: String) = messages.addOne(m)
val operation = Operation.delayed(add("action1")).flatMap(_ => Operation.delayed(add("action2"))).thenFinally(Operation.delayed(add("final")))
val operation = Operation
.delayed(add("action1"))
.flatMap(_ => Operation.delayed(add("action2")))
.thenFinally(Operation.delayed(add("final")))
val result = operation.runOption
result === Some(List("action1", "action2", "final"))

Expand All @@ -45,8 +47,14 @@ class OperationSpec extends Specification {
val messages = ListBuffer[String]();
def add(m: String) = messages.addOne(m)

val o1 = Operation.delayed(add("o1-1")).flatMap(_ => Operation.delayed(add("o1-2"))).thenFinally(Operation.delayed(add("final1")))
val o2 = Operation.delayed(add("o2-1")).flatMap(_ => Operation.delayed(add("o2-2"))).thenFinally(Operation.delayed(add("final2")))
val o1 = Operation
.delayed(add("o1-1"))
.flatMap(_ => Operation.delayed(add("o1-2")))
.thenFinally(Operation.delayed(add("final1")))
val o2 = Operation
.delayed(add("o2-1"))
.flatMap(_ => Operation.delayed(add("o2-2")))
.thenFinally(Operation.delayed(add("final2")))
val result = Applicative[Operation].tuple2(o1, o2).runOption.get._1.toList

// all effects are executed, including finalizers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class SpecificationsFinderSpec(env: Env) extends Spec with ThrownExpectations {
val output = new StringOutput {}
val logger = StringOutputLogger(output)
val env1 = env.setSystemLogger(logger)
SpecificationsFinder.create(env1)
SpecificationsFinder
.create(env1)
.findSpecifications(
basePath = DirectoryPath.unsafe(base) / "src" / "test" / "scala",
filter = filter
Expand Down
3 changes: 2 additions & 1 deletion examples/jvm/src/test/scala/examples/IntegrationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class IntegrationSpec(env: Env) extends Specification, StartDatabase(env):

}

val specifications = SpecificationsFinder.create(env)
val specifications = SpecificationsFinder
.create(env)
.findSpecifications(
// change this pattern if the specifications must be found in specific directories, or with specific names
glob = "**/*.scala",
Expand Down
7 changes: 4 additions & 3 deletions tests/jvm/src/test/scala/org/specs2/ModulesSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ object Module extends SpecificationCreation:
val env = EnvDefault.default
val finder = SpecificationsFinder.create(env)
val specs =
finder.findSpecifications(basePath = base, verbose = false, filter = filter)
.unsafeRun
.take(3)
finder
.findSpecifications(basePath = base, verbose = false, filter = filter)
.unsafeRun
.take(3)

env.shutdown()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FutureMatchersSpec(val env: Env) extends Specification with ResultMatchers
lazy val env1 = ownEnv.copy(arguments = Arguments("threadsnb 4"))
lazy val timeFactor = env1.arguments.execute.timeFactor
lazy val sleepTime = 50 * timeFactor.toLong

class MyTimeout extends TimeoutException

def is = section("ci") ^ sequential ^ s2"""
Expand Down

0 comments on commit c5c7d9a

Please sign in to comment.