disneystreaming / weaver-test

A test framework that runs everything in parallel.
https://disneystreaming.github.io/weaver-test/
Other
436 stars 49 forks source link

Hanging test with scalacheck using asciiStr #698

Open epifab opened 11 months ago

epifab commented 11 months ago

This could probably be replicated without using scalacheck, my theory is that it blows up the DiffUtils with some non-printable characters.

import org.scalacheck.{Arbitrary, Gen}
import weaver.scalacheck.*
import weaver.SimpleIOSuite

object NonTerminatingSuite extends SimpleIOSuite with Checkers:
  test("Fix me") {
    given Arbitrary[String] = Arbitrary(Gen.asciiStr)
    forall: (s: String) =>
      expect.same("", s)
  }

scala 3.3.0 weaver 0.8.3

epifab commented 11 months ago

to give a little more context, switching from asciiStr to printableAsciiStr fixes the issue

dabd commented 9 months ago

The issue comes from the way expecty DiffUtil tokenizes an Escape control character (Char with Int value 27). I have a fix in the works but I am not sure it will break the intention of this tokenization function, which is not well documented and actually is a copy-paste from dotty.

Minimal repro:

  pureTest("Fix me") {
    val s = 27.toChar.toString
    expect.same("", s)
  }