zio / zio

ZIO — A type-safe, composable library for async and concurrent programming in Scala
https://zio.dev
Apache License 2.0
4.08k stars 1.28k forks source link

zio-test assertTrue fails horribly on scala xml #6393

Open TimPigden opened 2 years ago

TimPigden commented 2 years ago

I get stack overflow (zio 2.0.0-RC2, scala 2.13.8) with following code

import zio.test.{ZIOSpecDefault, assertTrue}

object SmartAssertHatesXml extends ZIOSpecDefault {

  override def spec = suite("compare xml")(
    compareXml
  )

  def compareXml = test("blows up with stack overflow") {
    assertTrue(<a>a</a> == <b>b</b>)
  }

}

Yes - scala xml nodeseq is weird, but still it might show something about assumptions within the macro

TimPigden commented 2 years ago

any likelihood of this being sorted? It still fails with RC6

TimPigden commented 2 years ago

Hmm - i can see the problem - you'd need to treat xml NodeSeq specially - which means including xml library - which it seems unlikely you'd want to do.

TimPigden commented 2 years ago

trivial work-around assertTrue(myNode1.toString == myNode2.toString)

BennyMcBenBen commented 2 years ago

Note that this also fails with a stack overflow error:

assert(myNode1)(Assertion.equalTo(myNode2))

This is my workaround:

assert(true)(Assertion.equalTo(myNode1  == myNode2)