@@ -41,24 +41,26 @@ class CoverageTests:
41
41
lines
42
42
end fixWindowsPaths
43
43
44
- Files .walk(dir).filter(scalaFile.matches).forEach(path => {
45
- if Properties .testsFilter.isEmpty || Properties .testsFilter.exists(path.toString.contains) then
46
- val fileName = path.getFileName.toString.stripSuffix(" .scala" )
47
- val targetDir = computeCoverageInTmp(path, dir, run)
48
- val targetFile = targetDir.resolve(s " scoverage.coverage " )
49
- val expectFile = path.resolveSibling(s " $fileName.scoverage.check " )
50
-
51
- if updateCheckFiles then
52
- Files .copy(targetFile, expectFile, StandardCopyOption .REPLACE_EXISTING )
53
- else
54
- val expected = fixWindowsPaths(Files .readAllLines(expectFile).asScala)
55
- val obtained = fixWindowsPaths(Files .readAllLines(targetFile).asScala)
56
- if expected != obtained then
57
- for ((exp, actual),i) <- expected.zip(obtained).filter(_ != _).zipWithIndex do
58
- Console .err.println(s " wrong line ${i+ 1 }: " )
59
- Console .err.println(s " expected: $exp" )
60
- Console .err.println(s " actual : $actual" )
61
- fail(s " $targetFile differs from expected $expectFile" )
44
+ def runOnFile (p : Path ): Boolean =
45
+ scalaFile.matches(p) &&
46
+ (Properties .testsFilter.isEmpty || Properties .testsFilter.exists(p.toString.contains))
47
+
48
+ Files .walk(dir).filter(runOnFile).forEach(path => {
49
+ val fileName = path.getFileName.toString.stripSuffix(" .scala" )
50
+ val targetDir = computeCoverageInTmp(path, dir, run)
51
+ val targetFile = targetDir.resolve(s " scoverage.coverage " )
52
+ val expectFile = path.resolveSibling(s " $fileName.scoverage.check " )
53
+ if updateCheckFiles then
54
+ Files .copy(targetFile, expectFile, StandardCopyOption .REPLACE_EXISTING )
55
+ else
56
+ val expected = fixWindowsPaths(Files .readAllLines(expectFile).asScala)
57
+ val obtained = fixWindowsPaths(Files .readAllLines(targetFile).asScala)
58
+ if expected != obtained then
59
+ for ((exp, actual),i) <- expected.zip(obtained).filter(_ != _).zipWithIndex do
60
+ Console .err.println(s " wrong line ${i+ 1 }: " )
61
+ Console .err.println(s " expected: $exp" )
62
+ Console .err.println(s " actual : $actual" )
63
+ fail(s " $targetFile differs from expected $expectFile" )
62
64
63
65
})
64
66
0 commit comments