File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,24 @@ class PluginCoverageTest
36
36
37
37
38
38
// https://github.com/scoverage/sbt-scoverage/issues/16
39
- test(" scoverage should instrument for-loops" ) {
39
+ test(" scoverage should instrument for-loops but not the generated default case " ) {
40
40
compileCodeSnippet( """ trait A {
41
41
| def print1(list: List[String]) = for (string: String <- list) println(string)
42
42
|} """ .stripMargin)
43
- // we should have 3 statements
43
+ // should have one statement for the withFilter invoke, one of the match selector,
44
+ // one of the case block, one for the case string RHS value, one for the foreach block.
44
45
assertNMeasuredStatements(5 )
45
46
}
47
+
48
+ test(" scoverage should instrument all case statements in an explicit match" ) {
49
+ compileCodeSnippet( """ trait A {
50
+ | def foo(name: Any) = name match {
51
+ | case i : Int => 1
52
+ | case b : Boolean => 2
53
+ | case _ => 3
54
+ | }
55
+ |} """ .stripMargin)
56
+ // should have one statement for each literal, one for each case block, and one for the selector.
57
+ assertNMeasuredStatements(7 )
58
+ }
46
59
}
You can’t perform that action at this time.
0 commit comments