@@ -35,18 +35,21 @@ object FileDiff {
3535 else None
3636 }
3737
38- def matches(actual: String, expect: String): Boolean = {
39- val actual1 = actual.stripLineEnd
40- val expect1 = expect.stripLineEnd
38+ def matches(actual: String, expect: String): Boolean =
39+ val actual1 = actual.stripLineEnd
40+ val expect1 = expect.stripLineEnd
41+ // handle check file path mismatch on windows
42+ def matchesWindowsPath = File.separatorChar == '\\' && actual1.replace('\\', '/') == expect1
43+ // obscure line numbers in frames of stack trace output
44+ def obscureFrameLine(s: String): Option[String] =
45+ //at scala.quoted.runtime.impl.QuotesImpl$reflect$ClassDef$.module(QuotesImpl.scala:257)
46+ val frame = """\s+at [^(]+\([^:]+:(\d+)\)""".r
47+ frame.findFirstMatchIn(s).map(m => s"${m.before(1)}_${m.after(1)}")
48+ def matchesStackFrame =
49+ actual1.endsWith(")") && expect1.endsWith(")") && obscureFrameLine(actual1) == obscureFrameLine(expect1)
50+ actual1 == expect1 || matchesStackFrame || matchesWindowsPath
4151
42- // handle check file path mismatch on windows
43- actual1 == expect1 || File.separatorChar == '\\' && actual1.replace('\\', '/') == expect1
44- }
45-
46- def matches(actual: Seq[String], expect: Seq[String]): Boolean = {
47- actual.length == expect.length
48- && actual.lazyZip(expect).forall(matches)
49- }
52+ def matches(actual: Seq[String], expect: Seq[String]): Boolean = actual.corresponds(expect)(matches)
5053
5154 def dump(path: String, content: Seq[String]): Unit = {
5255 val outFile = dotty.tools.io.File(path)
0 commit comments