From 3d924978c22ffb360b6ddd69dd6144927fcb0e5e Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Sat, 22 Dec 2018 16:26:55 +0000 Subject: [PATCH] Add some matcher messaging to ParserSpec --- main/src/test/scala/ParserSpec.scala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main/src/test/scala/ParserSpec.scala b/main/src/test/scala/ParserSpec.scala index a46ea26f4..147abc6db 100644 --- a/main/src/test/scala/ParserSpec.scala +++ b/main/src/test/scala/ParserSpec.scala @@ -7,6 +7,7 @@ import java.net.URI +import org.scalatest.matchers.MatchResult import org.scalatest.prop.PropertyChecks import org.scalatest.{ Matchers, PropSpec } 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 string = displayMasked(scopedKey, ScopeMask()) val parser = makeParser(structure) - val result = DefaultParsers.result(parser, string).left.map(_().toString) - result shouldBe Right(scopedKey) + string should { left => + val result = DefaultParsers.result(parser, left) + val resultStr = result.fold(_ => "", _.toString) + MatchResult( + result == Right(scopedKey), + s"$left parsed back to $resultStr rather than $scopedKey", + s"$left parsed back to $scopedKey", + ) + } } }