-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from agourlay/infix-dynamic-type
Infix dynamic type
- Loading branch information
Showing
6 changed files
with
87 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/scala/com/github/agourlay/cornichon/steps/wrapped/AttachAsStep.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.agourlay.cornichon.steps.wrapped | ||
|
||
import com.github.agourlay.cornichon.core.{ FailureStepsResult, _ } | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
// Steps are wrapped/idented with a specific title | ||
case class AttachAsStep(title: String, nested: Vector[Step]) extends WrapperStep { | ||
|
||
def run(engine: Engine, session: Session, depth: Int)(implicit ec: ExecutionContext) = { | ||
val (res, executionTime) = engine.withDuration { | ||
engine.runSteps(nested, session, Vector.empty, depth + 1) | ||
} | ||
res match { | ||
case s: SuccessStepsResult ⇒ | ||
val updatedLogs = successTitleLog(depth) +: s.logs :+ SuccessLogInstruction(s"'$title' succeeded", depth, Some(executionTime)) | ||
s.copy(logs = updatedLogs) | ||
case f: FailureStepsResult ⇒ | ||
f.copy(logs = failedTitleLog(depth) +: f.logs :+ FailureLogInstruction(s"'$title' failed", depth)) | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/scala/com/github/agourlay/cornichon/steps/wrapped/AttachStep.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.agourlay.cornichon.steps.wrapped | ||
|
||
import com.github.agourlay.cornichon.core.{ Engine, Session, Step, WrapperStep } | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
// Transparent Attach has no title - steps are flatten in the main execution | ||
case class AttachStep(title: String = "", nested: Vector[Step]) extends WrapperStep { | ||
|
||
def run(engine: Engine, session: Session, depth: Int)(implicit ec: ExecutionContext) = | ||
engine.runSteps(nested, session, Vector.empty, depth) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters