Object/Trait

org.scalatest

Inside

Related Docs: trait Inside | package scalatest

Permalink

object Inside extends Inside

Companion object that facilitates the importing of the inside construct as an alternative to mixing it in. One use case is to import the inside construct so you can use it in the Scala interpreter:

$ scala -cp scalatest-1.8.jar
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import org.scalatest._
import org.scalatest._

scala> import matchers.Matchers._
import matchers.Matchers._

scala> import Inside._
import Inside._

scala> inside (List(1, 2, 3)) { case List(x, y, z) =>
    |   y should equal (2)
    | }

scala> inside (List(1, 2, 3)) { case List(x, y, z) =>
     |   x should equal (2)
     | }
org.scalatest.TestFailedException: 1 did not equal 2, inside List(1, 2, 3)
  at org.scalatest.matchers.Matchers$class.newTestFailedException(Matchers.scala:150)
  at org.scalatest.matchers.Matchers$.newTestFailedException(Matchers.scala:2331)
  at org.scalatest.matchers.Matchers$ShouldMethodHelper$.shouldMatcher(Matchers.scala:873)
  ...

Source
Inside.scala
Linear Supertypes
Inside, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Inside
  2. Inside
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. def inside[T, U](value: T)(pf: PartialFunction[T, U])(implicit pos: Position): U

    Permalink

    Inspects inside the passed value using the passed partial function.

    Inspects inside the passed value using the passed partial function.

    The inside method checks to see whether the partial function passed as the second curried parameter is defined at the value passed as the first parameter, and if so, passes that value to the partial function.

    If the partial function is not defined at the passed value, inside will throw a TestFailedException with a detail message describing the problem. Otherwise, if the partial function returns normally, inside will return normally. If the partial function completes abruptly with an exception that mixes in ModifiableMessage (such as TestFailedException), inside will append the value's toString of to the exception's detail message, and rethrow it. If the exception thrown by the partial function does not mix in ModifiableMessage, inside completes abruptly with that same exception.

    value

    the value inside of which to inspect

    pf

    the partial function to use to inspect inside the passed value

    Definition Classes
    Inside
    Exceptions thrown

    TestFailedException if the passed partial function is not defined at the passed value

  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  17. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Inside

Inherited from AnyRef

Inherited from Any

Ungrouped