how to log original arguments before shrink in scalacheck - scalacheck

When I use Shrink in my scalacheck test, scalacheck only print arguments after shrink that failed my test case. Is there any way to make scalacheck also print the original arguments before shrink? Thanks!

Related

Intellij Scala worksheet Run type difference explain

In Intellij Scala Worksheet support, what is the difference between the Run types i.e PLAIN vs REPL ?
Plain evaluation model compiles the whole worksheet in one go before evaluating expressions, whilst REPL evaluation model evaluates each expression on the go before moving to the next one.
Adding an expression in REPL mode evaluates incrementally just that new expression, whilst in Plain mode it would re-interpret the whole worksheet from the beginning.
An example where the difference matters is when defining companion objects. Similarly to how in Scala REPL proper we have to use :paste command to define companion, in IntelliJ Scala Worksheet we have to use Plain run type.
REPL mode as it says READ EVALUATE PRINT LOOP is kind of interpreter i.e. each expression will be evaluated after to move to next line.. It is generally used to make quick logic checks.
while in worksheet mode you need to make an object or class.. worksheet is the traditional OOPS way like we do in java and whole file is compiled in one go.

Scala warning without line number

I am seeing a few of these warnings in my build:
At the end of the day, could not inline #inline-marked method ->$extension
These are produced by using operator -> in Map in scala 2.10 (I can't move to scala 2.12 right now).
but no line number is provided. Is there a scala compiler option I need to turn on to get line number details?

How do I make sbt output stack traces of TestFailedExceptions?

How do I make sbt output the stack traces of TestFailedExceptions, as thrown by ScalaTest, instead of suppressing them, which seems to be the default?
We use the 'F' option to ScalaTest/sbt, but it doesn't affect TestFailedException apparently.
ScalaTest's F option actually does the trick. A bug in our build.sbt file cleared this option unfortunately, so it only looked as if it was enabled.

Where can I find documentation of RPM macro expansion?

I'm working with some RPM spec files and .rpmmacros which are failing with a newer version or build of RPM than they were intended to be used with, and I'm trying to make sense of them, but I can't find any good documentation on how RPM expands parameterized macros. In particular, I'm unclear whether %% inside the macro body, which presumably expands to a single %, gets expanded again after the first macro is expanded, or remains as a literal % sign. But what I'd really like is some good documentation on the whole RPM macro system, which I'm unfamiliar with (I inherited the mess from somebody else and wouldn't be using RPM by choice at all). Any pointers?
if you run
rpm --showrc
you get the value of every macro currently known to rpm.
Among that output, lookout for the line stating with macrofiles, it contains a list of every macro file rpm evaluates to get to the values.

Debuggin single lines in Scala

A single of code can achieve a lot in Scala.
def -(that: Nat) = if (that.isZero) this else throw new Error("negative number")
However, it is difficult to debug.
Any tips?
Use scala worksheet. That's it: you'll get multiline REPL with your environment in which you can play with your code.
Alternatively, just use REPL bundled with sbt (sbt console) with proper imports
you can see output of compiler phases, i.e. the AST after desugarings with
scalac -Xprint:typer
scalac -Xprint-types (note hyphen, not colon)
The man page is a little confusing, there's no "typer" phase listed, but it works:
http://www.scala-lang.org/docu/files/tools/scalac.html
Compile time type tracing