从scalacheck
运行sbt console
时,输出受限于66个字符列宽度:
$ sbt test:console
import scalaz._
import Scalaz._
import scalacheck.ScalazProperties._
import scalacheck.ScalazArbitrary._
import scalacheck.ScalaCheckBinding._
scala> monad.laws[List].check
+ monad.applicative.apply.functor.invariantFunctor.identity: OK, passed 100
tests.
+ monad.applicative.apply.functor.invariantFunctor.composite: OK, passed 10
0 tests.
+ monad.applicative.apply.functor.identity: OK, passed 100 tests.
+ monad.applicative.apply.functor.composite: OK, passed 100 tests.
+ monad.applicative.apply.composition: OK, passed 100 tests.
+ monad.applicative.identity: OK, passed 100 tests.
+ monad.applicative.homomorphism: OK, passed 100 tests.
+ monad.applicative.interchange: OK, passed 100 tests.
+ monad.applicative.map consistent with ap: OK, passed 100 tests.
+ monad.bind.apply.functor.invariantFunctor.identity: OK, passed 100 tests.
+ monad.bind.apply.functor.invariantFunctor.composite: OK, passed 100 tests
.
+ monad.bind.apply.functor.identity: OK, passed 100 tests.
+ monad.bind.apply.functor.composite: OK, passed 100 tests.
+ monad.bind.apply.composition: OK, passed 100 tests.
+ monad.bind.associativity: OK, passed 100 tests.
+ monad.bind.ap consistent with bind: OK, passed 100 tests.
+ monad.right identity: OK, passed 100 tests.
+ monad.left identity: OK, passed 100 tests.
有没有办法增加这个限制?
答案 0 :(得分:2)
遗憾的是,这不可能改变,因为它在ScalaCheck(https://github.com/rickynils/scalacheck/blob/master/src/main/scala/org/scalacheck/util/ConsoleReporter.scala)中是硬编码的。我建议在ScalaCheck的Github页面上打开一个问题。
答案 1 :(得分:0)
由于ConsoleReporter
中的宽度值是硬编码的,因此不可能。但是,如果您使用main
中定义的Properties
运行测试,则可以执行以下操作:
object MyCheck extends Properties("My property check") {
override def overrideParameters(p: Test.Parameters) =
p.withTestCallback(WideConsoleReporter)
...
}
然后在您自己的代码中,根据WideConsoleReporter
创建ConsoleReporter
。