Skip to content

Commit

Permalink
Add checkConfig override to error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
zainab-ali committed May 2, 2024
1 parent 6a97916 commit 2a6a4b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ trait Checkers {
val ith = succeeded + discarded + 1
val failure = Expectations.Helpers
.failure(
s"Property test failed on try $ith with seed ${seed} and input $input")
s"""Property test failed on try $ith with seed $seed and input $input.
|You can reproduce this by adding the following override to your suite:
|
|override def checkConfig = super.checkConfig.withInitialSeed($seed.toOption)""".stripMargin)
.and(exp)
copy(failure = Some(failure))
} else this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ object PropertyDogFoodTest extends IOSuite {
("2", "0")
}

val expectedMessage =
s"""Property test failed on try $attempt with seed Seed.fromBase64("$seed") and input $value"""
expect(log.contains(expectedMessage))
val actualLines = log.split(System.lineSeparator()).toList
val expectedLines = s"""foobar
|Property test failed on try $attempt with seed Seed.fromBase64("$seed") and input $value.
|You can reproduce this by adding the following override to your suite:
|
|override def checkConfig = super.checkConfig.withInitialSeed(Seed.fromBase64("$seed").toOption)"""
.stripMargin
.linesIterator.toList

forEach(actualLines.zip(expectedLines))({ case (actual, expected) =>
expect(actual.contains(expected))
})
}
}
}
Expand Down

0 comments on commit 2a6a4b0

Please sign in to comment.