Snippets

org.specs2.specification.Snippets
See theSnippets companion object
trait Snippets extends Snippets

Snippets of code can be extracted from interpolated specification strings.

When you want to specify that a piece of code must be included in the specification output, you can use the snippet method to execute a this code and use the text in the output. If you just want to output part of the code you need to delimit it with some comments // 8<------- (with as many dashes as you want)

Generally the last value of a snippet will be displayed separately but it is possible to avoid this by using the mute method on a Snippet.

It is also possible to check that the result value is equal to a specific value by using the check[R : AsResult](f: T => R) method.

Attributes

Companion
object
Graph
Supertypes
trait Snippets
class Object
trait Matchable
class Any
Self type

Members list

Value members

Inherited methods

inline def fullName[T]: String

Attributes

Inherited from:
Snippets
inline def simpleName[T]: String

Attributes

Inherited from:
Snippets
inline def snippet[T](inline code: => T)(using params: SnippetParams[T]): Snippet[T]

Attributes

Inherited from:
Snippets
inline def termName[T](inline t: => T): String

Attributes

Inherited from:
Snippets

Givens

Inherited givens

given defaultSnippetParameters[T]: SnippetParams[T]

implicit parameters selected for the creation of Snippets

implicit parameters selected for the creation of Snippets

Attributes

Inherited from:
Snippets

Extensions

Inherited extensions

extension [T](s: Snippet[T])
def eval: Snippet[T]

implicit function modify the Snippet parameters

implicit function modify the Snippet parameters

Attributes

Inherited from:
Snippets
def offsetIs(offset: Int): Snippet[T]

implicit function modify the Snippet parameters

implicit function modify the Snippet parameters

Attributes

Inherited from:
Snippets
def promptIs(p: String): Snippet[T]

implicit function modify the Snippet parameters

implicit function modify the Snippet parameters

Attributes

Inherited from:
Snippets
def set(trimExpression: String => String, cutter: String => String, asCode: (String, String) => String, prompt: String => String): Snippet[T]

implicit function modify the Snippet parameters

implicit function modify the Snippet parameters

Attributes

Inherited from:
Snippets
extension [T, R](s: Snippet[T])(using evidence$1: AsResult[R])
def check(f: T => R): Snippet[T]

Attributes

Inherited from:
Snippets
extension [T](s: Snippet[T])(using evidence$2: AsResult[T])
def checkOk: Snippet[T]

Attributes

Inherited from:
Snippets

Implicits

Implicits

implicit inline def snippetIsInterpolatedFragment[T](inline snippet: Snippet[T]): Interpolated