org.specs.matcher.PatternMatchers

object PatternMatchers

object PatternMatchers

 extends PatternMatchers


Companion object for PatternMatchers.


Companion: PatternMatchers

Source: PatternMatchers.scala(115)

 Constructors

def this

 Fields

beSomething def beSomething
Alias for beSome[Any]
CaseMatcher[Any] PatternMatchers

 Methods

!= final def !=(arg0 : Object) Boolean AnyRef
!= final def !=(arg0 : Any) Boolean Any
== final def ==(arg0 : Any) Boolean Any
== final def ==(arg0 : Object) Boolean AnyRef
asInstanceOf final def asInstanceOf[T0] T0 Any
beAlsoNone def beAlsoNone[T](a : => Option[T])
[details]
deprecated
- use beAsNoneAs
Matcher[Option[T]] PatternMatchers
beAsNoneAs def beAsNoneAs[T](a : => Option[T])
Matches if a is None when v is None and a is not None when v is not None
Matcher[Option[T]] PatternMatchers
beLike def beLike(pattern : => (Any) => Boolean)
Matches if the value v is like the pattern { case expression => boolean }

It uses the fact that we can use the following syntax to map Options:

  • myOption [details]
    map { case expression => boolean }

In that case, the pattern parameter would be { case expression => boolean }, a function of type Any => Boolean

The Sugar object can be used to get a shorter expression by having the ok alias for true:

  • List(1, 2) must beLike { case x::y::Nil => ok }
param
pattern - a case expression
return
- false if there is no match
- the value inside the mapped option if there is a match, which should be true
Matcher[Any] PatternMatchers
beNone def beNone[T]
Matches if the value v is None
Matcher[Option[T]] PatternMatchers
beSome def beSome[T]
Matches if the value v is Some(x)
CaseMatcher[T] PatternMatchers
clone protected def clone Object AnyRef
eq final def eq(arg0 : Object) Boolean AnyRef
equals def equals(arg0 : Any) Boolean AnyRef
finalize protected def finalize Unit AnyRef
getClass final def getClass Class[Object] AnyRef
hashCode def hashCode Int AnyRef
isInstanceOf final def isInstanceOf[T0] Boolean Any
ne final def ne(arg0 : Object) Boolean AnyRef
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toString def toString String AnyRef
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
wait final def wait Unit AnyRef
wait final def wait(arg0 : Long) Unit AnyRef
Copyright (c) 2007-2009. All Rights Reserved.