@@ -35,18 +35,21 @@ object FileDiff {
35
35
else None
36
36
}
37
37
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
41
51
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)
50
53
51
54
def dump (path : String , content : Seq [String ]): Unit = {
52
55
val outFile = dotty.tools.io.File (path)
0 commit comments