Muki-SkyWalker / specs

Automatically exported from code.google.com/p/specs
Other
0 stars 0 forks source link

Iterable matchers doesn't work #162

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
import org.specs.Specification

object SomeSpec  extends Specification{
  "Some" should{
    "compile without errors" in {
      Iterable(1,2,3) must containAll Iterable(3,1,2)
    }
  }
}

What is the expected output?
"build successful"
What do you see instead?
..... : polymorphic expression cannot be instantiated to expected type;
found: [T](l: scala.Iterable[T])(implicit 
details:org.specs.specification.Detailed)org.specs.matcher.Matcher[scala.Iterabl
e[T]]
required: org.specs.matcher.Matcher[Iterable[Int]]

Compilation failed

What version of the product are you using? On what operating system?
"org.scala-tools.testing" % "specs_2.8.0" % "1.6.5" 
on Windows XP SP2

Please provide any additional information below.
It seems that some implicit defs had lost somewhere. Maybe I hadn't imported 
something but I can't see anything helpful on MatchersGuide page.

Original issue reported on code.google.com by jerihofr...@gmail.com on 5 Oct 2010 at 8:52

GoogleCodeExporter commented 9 years ago
Hi, you need to add parenthesis for the match to work:

Iterable(1,2,3) must containAll(Iterable(3,1,2))

// or if you prefer

Iterable(1,2,3) must containAll (Iterable(3,1,2))

Otherwise this is interpreted by the compiler as:

(Iterable(1,2,3) must containAll) ... and Iterable(3,1,2)

where containAll is a function returning a matcher, which is not what is 
expected by the must method.

Original comment by etorrebo...@gmail.com on 5 Oct 2010 at 10:39