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

Call Count feature is broken #547

Open
eanea opened this issue Nov 29, 2024 · 2 comments
Open

Call Count feature is broken #547

eanea opened this issue Nov 29, 2024 · 2 comments

Comments

@eanea
Copy link

eanea commented Nov 29, 2024

ScalaMock Version

6.0.0

Scala Version

3.3.3 and 3.3.4

Runtime (JVM)

JDK 21

Please describe the expected behavior of the issue

I expect that count of call works correctly.
.once() - only one method call
.twice() - exactly 2 method calls

Please provide a description of what actually happens

the .twice() or any other repeat(N) behaves as actualCalls <= expectedCalls

Reproducible Test Case

https://scastie.scala-lang.org/OePoGGbMRPORVkfaR1zazw

@goshacodes
Copy link
Collaborator

Thank you, I'll look into this

@goshacodes
Copy link
Collaborator

goshacodes commented Jan 3, 2025

I've created a test case and it fails. Can you try this?

import org.scalamock.scalatest.MockFactory
import org.scalatest.funsuite.AnyFunSuite

class AnotherCallCountSpec extends AnyFunSuite, MockFactory:
  
  trait Boo:
    def boo(i: Int): String

  test("twice"):
    val booMock = mock[Boo]
    val expected = "booNumber"
    (booMock
      .boo(_: Int))
      .expects(*)
      .returns(expected)
      .twice()

    val x = booMock.boo(1)
    assert(x === expected)

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

2 participants