mirror of https://github.com/sbt/sbt.git
Add some matcher messaging to ParserSpec
This commit is contained in:
parent
6988b2289a
commit
3d924978c2
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
|
import org.scalatest.matchers.MatchResult
|
||||||
import org.scalatest.prop.PropertyChecks
|
import org.scalatest.prop.PropertyChecks
|
||||||
import org.scalatest.{ Matchers, PropSpec }
|
import org.scalatest.{ Matchers, PropSpec }
|
||||||
import sbt.Def._
|
import sbt.Def._
|
||||||
|
|
@ -71,7 +72,14 @@ class ParserSpec extends PropSpec with PropertyChecks with Matchers {
|
||||||
val structure = TestBuild.structure(env, settings, build.allProjects.head._1)
|
val structure = TestBuild.structure(env, settings, build.allProjects.head._1)
|
||||||
val string = displayMasked(scopedKey, ScopeMask())
|
val string = displayMasked(scopedKey, ScopeMask())
|
||||||
val parser = makeParser(structure)
|
val parser = makeParser(structure)
|
||||||
val result = DefaultParsers.result(parser, string).left.map(_().toString)
|
string should { left =>
|
||||||
result shouldBe Right(scopedKey)
|
val result = DefaultParsers.result(parser, left)
|
||||||
|
val resultStr = result.fold(_ => "<parse error>", _.toString)
|
||||||
|
MatchResult(
|
||||||
|
result == Right(scopedKey),
|
||||||
|
s"$left parsed back to $resultStr rather than $scopedKey",
|
||||||
|
s"$left parsed back to $scopedKey",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue