These are chat archives for etorreborre/specs2

24th
Apr 2018
Eric Torreborre
@etorreborre
Apr 24 2018 08:28
@mdimjasevic besides the tests that are not passing I think we need to study the full story for showing/setting seeds. See the examples here. In particular in specs2 I want to always show the seed on failure, I think this should be the default
Marko Dimjašević
@mdimjasevic
Apr 24 2018 08:49
Agreed
Marko Dimjašević
@mdimjasevic
Apr 24 2018 09:47
That was an interesting read. Maybe specs2 could print a used seed regardless of the outcome, i.e., including when tests are passing.
Eric Torreborre
@etorreborre
Apr 24 2018 09:51
I would do it only on failure because I don’t like to have my test output cluttered with things. But say we add an option to print the seed on success, what would you use it for? Also you would actually need to output 100 seeds for 100 tests isn’t it?
Marko Dimjašević
@mdimjasevic
Apr 24 2018 09:55
You're right. It'd be too much noise.
Marko Dimjašević
@mdimjasevic
Apr 24 2018 10:11
@etorreborre : I just pulled your changes related to -Xmx from yesterday and when I try to start sbt, I get this after which sbt exits:
$ sbt
[info] Loading global plugins from /home/mdimjase/.sbt/0.13/plugins
[info] Loading project definition from /home/mdimjase/repos/specs2/project
[info] Resolving key references (18439 settings) ...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[info] Set current project to specs2 (in build file:/home/mdimjase/repos/specs2/)
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
I believe it's this option you added to .sbtopts: -XX:+CMSClassUnloadingEnabled
Marko Dimjašević
@mdimjasevic
Apr 24 2018 10:16
Actually, it's not it. I tried removing it and it still terminates.
Eric Torreborre
@etorreborre
Apr 24 2018 10:16
I’m pretty sure I had it as well and did… something
which sbt launcher are you using?
Apparently the flags need to be prefixed with -J, I pushed a fix
Marko Dimjašević
@mdimjasevic
Apr 24 2018 11:10
I have 1.1.2
Why would an implication in ScalaCheckMatchersApiSpec be failing?
Eric Torreborre
@etorreborre
Apr 24 2018 11:12
It would fail if it does not generate enough different cases like n > 0 ==> n > 0 should fail half the time if the distribution of Gen[Int] is ok. Maybe the seed is not being passed around properly. First you should try to see if you can reproduce the issue with bare ScalaCheck. If that works ok, this means we’re doing something wrong in specs2
Marko Dimjašević
@mdimjasevic
Apr 24 2018 11:16
ok
Marko Dimjašević
@mdimjasevic
Apr 24 2018 12:30
Eric, I don't know how to check this
Eric Torreborre
@etorreborre
Apr 24 2018 12:31
Check if scalacheck behaves ok?
Marko Dimjašević
@mdimjasevic
Apr 24 2018 12:33
right. I don't know how to do that
Eric Torreborre
@etorreborre
Apr 24 2018 12:35

You need to write a “ScalaCheck spec” like this:

import org.scalacheck._
import org.scalacheck.Prop.forAll

class DemoProps extends Properties(“filter") {
  property(“test") =
    forAll { (n: Int) =>
      n > 0 ==> n > 0
    }
}

and run it with sbt to see if it passes

this should work out of the box
Marko Dimjašević
@mdimjasevic
Apr 24 2018 12:42
it seems to be working
Eric Torreborre
@etorreborre
Apr 24 2018 12:42
Great, so the bug is in specs2 :-)
I don’t really know how to fix it. I suspect that somewhere we use a random Seed over and over instead of grabbing it once and starting from there. I will try to have a look at it later if you don’t want to dive too much into that
Marko Dimjašević
@mdimjasevic
Apr 24 2018 12:48
I'd appreciate that!