Knows Not Much Knows Not Much - 1 year ago 82
Scala Question

What does "^^" mean in Scala library specs2

I came across this line of code today

def beCapitalizedAs(capitalized: String) = be_==(capitalized) ^^

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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download