Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method overloads are not treated as separate methods in report #297

Open
unkarjedy opened this issue Oct 26, 2020 · 0 comments
Open

method overloads are not treated as separate methods in report #297

unkarjedy opened this issue Oct 26, 2020 · 0 comments

Comments

@unkarjedy
Copy link

Run coverage for this class:

package example

class MethodOverloads {

  def foo(): String = {
    "0"
  }

  def foo(p1: Int): String = {
    "1"
  }

  def foo(p1: Int, p2: Int): String = {
    "2"
  }
}
import org.scalatest.FunSuite

class MethodOverloadsTest extends FunSuite {

  test("test" ) {
    new MethodOverloads().foo()
    new MethodOverloads().foo(1)
    new MethodOverloads().foo(1, 2)
  }
}

See that scoverage.xml contains info for single "merged" foo method, for not 3 separate methods
(I removed all non-actual info):

<class name="example.MethodOverloads" filename="example\MethodOverloads.scala">
    <methods>
        <method
                name="example/MethodOverloads/foo"
                statement-count="3"
                statements-invoked="3"
                statement-rate="100.00"
                branch-rate="100.00">
            <statements>
                <statement method="foo" start="128" end="131" line="10" branch="false" invocation-count="1"/>
                <statement method="foo" start="80" end="83" line="6" branch="false" invocation-count="1"/>
                <statement method="foo" start="185" end="188" line="14" branch="false" invocation-count="1"/>
            </statements>
        </method>
    </methods>
</class>

Html report shows 1 in Methods columns as well

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant