2
2
3
3
![ build] ( https://github.com/scoverage/scalac-scoverage-plugin/workflows/build/badge.svg )
4
4
[ ![ Gitter] ( https://img.shields.io/gitter/room/scoverage/scoverage.svg )] ( https://gitter.im/scoverage/scoverage )
5
- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.10.svg?label=latest%20release%20for%202.10 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.10%22 )
6
5
[ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.11.12.svg?label=latest%202.11%20Scala%20support%20[2.11.12]%20and%20latest%20version )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.11.12%22 )
7
- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.12.14.svg?label=2.12%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.12.15%22 )
8
- [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.13.6.svg?label=2.13%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.13.6%22 )
6
+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.12.16.svg?label=2.12%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.12.16%22 )
7
+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-plugin_2.13.8.svg?label=2.13%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-plugin_2.13.8%22 )
8
+ [ ![ Maven Central] ( https://img.shields.io/maven-central/v/org.scoverage/scalac-scoverage-domain_3.svg?label=3%20Scala%20support%20 )] ( http://search.maven.org/#search|ga|1|g%3A%22org.scoverage%22%20AND%20a%3A%22scalac-scoverage-domain_3%22 )
9
9
[ ![ License] ( http://img.shields.io/:license-Apache%202-red.svg )] ( http://www.apache.org/licenses/LICENSE-2.0.txt )
10
10
11
11
scoverage is a free Apache licensed code coverage tool for Scala that offers
@@ -14,12 +14,14 @@ statement and branch coverage. scoverage is available for
14
14
[ Maven] ( https://github.com/scoverage/scoverage-maven-plugin ) , and
15
15
[ Gradle] ( https://github.com/scoverage/gradle-scoverage ) .
16
16
17
- To see scoverage in action check out the
18
- [ samples] ( https://github.com/scoverage/scoverage-samples ) project which shows
19
- you covered and non-covered statements, along with an upload to coveralls.
20
17
21
- ![ Screenshot of scoverage report html] ( misc/screenshot2.png )
18
+ ** NOTE** : That this repository contains the Scala compiler plugin for Code coverage
19
+ in Scala 2 and other coverage utilities for generating reports. For Scala 3 code
20
+ coverage the [ compiler] ( https://github.com/lampepfl/dotty ) natively produces
21
+ code coverage output, but the reporting logic utilities are then shared with the
22
+ Scala 2 code coverage utilities in this repo.
22
23
24
+ ![ Screenshot of scoverage report html] ( misc/screenshot2.png )
23
25
24
26
### Statement Coverage
25
27
@@ -31,19 +33,19 @@ In powerful, expressive languages like Scala, quite often multiple statements, o
31
33
are included on a single line, eg a very simple example:
32
34
33
35
```
34
- val status = if (age < 18) "No beer" else "Beer for you"
36
+ val status = if (Color == Red) Stop else Go
35
37
```
36
38
37
- If you had a unit test that ran through the value 18 you would get 100% line coverage
39
+ If you had a unit test that ran through the Color Red you would get 100% line coverage
38
40
yet you only have 50% statement coverage.
39
41
40
42
Let's expand this example out to be multifacted, albeit somewhat contrived:
41
43
42
44
```
43
- val status = if (religion == "Pentecostalist") "Beer forbidden" else if (age < 18) "Underage" else "Beer for you"
45
+ val status = if (Color == Red) Stop else if (Sign == Stop) Stop else Go
44
46
```
45
47
46
- Now we would get 100% code coverage for passing in the values ("Buddhist", 34 ).
48
+ Now we would get 100% code coverage for passing in the values (Green, SpeedLimit ).
47
49
48
50
That's why in scoverage we focus on statement coverage, and don't even include line coverage as a metric.
49
51
This is a paradigm shift that we hope will take hold.
0 commit comments