org.scalatest.verb

CanVerb

trait CanVerb extends AnyRef

Provides an implicit conversion that adds can methods to Stringto support the syntax of FlatSpec, WordSpec, FixtureFlatSpec, and FixtureWordSpec.

For example, this trait enables syntax such as the following test registration in FlatSpecand FixtureFlatSpec:

"A Stack (when empty)" can "be empty" in { ... }
                       

It also enables syntax such as the following shared test registration in FlatSpecand FixtureFlatSpec:

"A Stack (with one item)" can behave like nonEmptyStack(stackWithOneItem, lastValuePushed)
                          

In addition, it supports the registration of subject descriptions in WordSpecand FixtureWordSpec, such as:

"A Stack (when empty)" can { ...
                       

And finally, it also supportds the registration of subject descriptions with after words in WordSpec and FixtureWordSpec. For example:

   def provide = afterWord("provide")

"The ScalaTest Matchers DSL" can provide {

The reason this implicit conversion is provided in a separate trait, instead of being provided directly in FlatSpec, WordSpec, FixtureFlatSpec, andFixtureWordSpec, is primarily for design symmetry with ShouldVerband MustVerb. Both ShouldVerb and MustVerb must exist as a separate trait because an implicit conversion provided directly would conflict with the implicit conversion that provides should or must methods on Stringin the ShouldMatchers and MustMatchers traits.

known subclasses: FixtureWordSpec, FixtureFlatSpec, WordSpec, FlatSpec
    authors:
  1. Bill Venners

Inherited
  1. Hide All
  2. Show all
  1. AnyRef
  2. Any
Visibility
  1. Public
  2. All

Type Members

  1. class StringCanWrapperForVerb extends AnyRef

    This class supports the syntax of FlatSpec, WordSpec, FixtureFlatSpec, and FixtureWordSpec.

Value Members

  1. def !=(arg0: AnyRef): Boolean

  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

  3. def ##(): Int

  4. def $asInstanceOf[T0](): T0

  5. def $isInstanceOf[T0](): Boolean

  6. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

  7. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

  8. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

  9. def clone(): AnyRef

    This method creates and returns a copy of the receiver object.

  10. implicit def convertToStringCanWrapper(o: String): StringCanWrapperForVerb

    Implicitly converts an object of type String to a StringCanWrapper, to enable can methods to be invokable on that object.

  11. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

  12. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

  13. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object.

  14. def getClass(): java.lang.Class[_ <: java.lang.Object]

    Returns a representation that corresponds to the dynamic class of the receiver object.

  15. def hashCode(): Int

    Returns a hash code value for the object.

  16. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

  17. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

  18. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor.

  19. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor.

  20. def synchronized[T0](arg0: T0): T0

  21. def toString(): String

    Returns a string representation of the object.

  22. def wait(): Unit

  23. def wait(arg0: Long, arg1: Int): Unit

  24. def wait(arg0: Long): Unit