3

scalacheck从输出运行时,sbt console受 76 个字符的列宽限制:

$ 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.

有没有办法增加这个限制?

4

2 回答 2

2

不幸的是,这是不可能改变的,因为它在 ScalaCheck 中是硬编码的(在https://github.com/rickynils/scalacheck/blob/master/src/main/scala/org/scalacheck/util/ConsoleReporter.scala中) . 我建议在 ScalaCheck 的 Github 页面上打开一个问题。

于 2015-06-30T20:09:54.810 回答
1

这是不可能的,因为宽度值是硬编码的ConsoleReporter。但是,如果您使用main定义的 in运行测试,则Properties可以执行以下操作:

object MyCheck extends Properties("My property check") {

  override def overrideParameters(p: Test.Parameters) =
      p.withTestCallback(WideConsoleReporter)

  ...

}

然后在您自己的代码中,WideConsoleReporter基于ConsoleReporter.

于 2018-01-10T17:07:58.057 回答