How to increase the char column width for the scalacheck console output?

159 views Asked by At

When running scalacheck from an sbt console the output is limited by 76 char column width:

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

Is there any way to increase that limit?

2

There are 2 answers

0
Jim On

It is impossible as the width value is hard coded in ConsoleReporter. However, if you are running your tests with the main defined in Properties, you can do the following:

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

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

  ...

}

And then in your own code, create WideConsoleReporter based on ConsoleReporter.

1
Rickard Nilsson On

This is unfortunately not possible to change, as it is hard-coded in ScalaCheck (in https://github.com/rickynils/scalacheck/blob/master/src/main/scala/org/scalacheck/util/ConsoleReporter.scala). I suggest opening an issue at ScalaCheck's Github page.