Search code examples
scalaspecs2

What does "^^" mean in Scala library specs2


I came across this line of code today

def beCapitalizedAs(capitalized: String) = be_==(capitalized) ^^
    ((_:String).toUpperCase)

I don't know what "^^" means. I also googled but couldn't find anything.


Solution

  • It is defined on the specs2 Matcher trait and is meant to adapt one matcher to another.

    This means you can change the actual value before doing the match, i.e. in your example beCapitalizedAs will do the comparison on a capitalized String before match.

    Also see the specs Matchers guide for further information.