Skip to content

Upgrading tests from old style/version #1240

Answered by etorreborre
rbscgh asked this question in Q&A
Discussion options

You must be logged in to vote

I might have thrown the baby out with the bath water...

  1. Scope was related with some Before/After traits that were using DelayedInit with disappear with Scala 3.
  2. Since Scope involves some exception throwing inside the body of a trait definition, it has to be really well implemented otherwise the whole specification fails to be instantiated.

That being said I understand how it can be syntactically useful so maybe it is time to re-introduce it.
You can use that code in the meantime:

import org.specs2.execute.*

trait Scope

object Scope:
  given scopeAsResult[S <: Scope]: AsResult[S] = new AsResult[S]:
    def asResult(t: =>S): Result = AsResult.safely { Result.resultOrSuccess(t) }

// Exa…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@etorreborre
Comment options

@etorreborre
Comment options

@rbscgh
Comment options

Answer selected by rbscgh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants